@Override public Object apply(int arg0) { return internalRow.apply(arg0); }
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()); }
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);
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));
List<String> values = new ArrayList<>(); for(Row row: rows) { values.add(row.apply(0).toString());
final Object rowObj = row.apply(i); if (rowObj != null) { if (field.name().equals("geom")) {