org.apache.spark.sql.Row.apply()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(271)

本文整理了Java中org.apache.spark.sql.Row.apply方法的一些代码示例,展示了Row.apply的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Row.apply方法的具体详情如下:
包路径:org.apache.spark.sql.Row
类名称:Row
方法名:apply

Row.apply介绍

暂无

代码示例

代码示例来源:origin: cloudera-labs/envelope

@Override
public Object apply(int arg0) {
 return internalRow.apply(arg0);
}

代码示例来源:origin: jpmml/jpmml-sparkml

static
private List<?> getColumn(Dataset<Row> dataset, String name){
  List<Row> rows = dataset.select(name)
    .collectAsList();
  return rows.stream()
    .map(row -> row.apply(0))
    .collect(Collectors.toList());
}

代码示例来源:origin: stackoverflow.com

for(String s: matchKey)
    if(tblRow.apply(finalSchema.get(s))!=null){
      strID+= tblRow.apply(finalSchema.get(s)).toString().trim().toLowerCase();
for (int itr = 0; itr < rowSize; itr++)
  if(tblRow.apply(itr)!=null)
    newRow[itr] = tblRow.apply(itr);
  if(argRow1.apply(itr)!=null && argRow2.apply(itr)!=null)
      newRow[itr] = Integer.parseInt(argRow1.apply(itr).toString())+Integer.parseInt(argRow2.apply(itr).toString());
    }else{
      newRow[itr] = argRow2.apply(itr);

代码示例来源:origin: stackoverflow.com

StructType objStructType = inputDataFrame.schema();
   StructField []arrStructField=objStructType.fields();
   List<StructField> fields = new ArrayList<StructField>();
   List<StructField> newfields = new ArrayList<StructField>();
   List <StructField> listFields = Arrays.asList(arrStructField);
   StructField a = DataTypes.createStructField(leftCol,DataTypes.StringType, true);
   fields.add(a);
   newfields.addAll(listFields);
   newfields.addAll(fields);
   final int size = objStructType.size();
 JavaRDD<Row> rowRDD =   inputDataFrame.javaRDD().map(new Function<Row, Row>() {
   private static final long serialVersionUID = 3280804931696581264L;
   public Row call(Row tblRow) throws Exception {
       Object[] newRow = new Object[size+1];
       int rowSize=    tblRow.length();
       for (int itr = 0; itr < rowSize; itr++)
       {
         if(tblRow.apply(itr)!=null)
         {
           newRow[itr] = tblRow.apply(itr);
         }
       }
       newRow[size] = UUID.randomUUID().toString();
       return RowFactory.create(newRow);
   }
 });
 inputDataFrame = objsqlContext.createDataFrame(rowRDD, DataTypes.createStructType(newfields));

代码示例来源:origin: ddf-project/DDF

List<String> values = new ArrayList<>();
for(Row row: rows) {
 values.add(row.apply(0).toString());

代码示例来源:origin: locationtech/geowave

final Object rowObj = row.apply(i);
if (rowObj != null) {
 if (field.name().equals("geom")) {

相关文章