@Override public int size() { return internalRow.size(); }
for (int fieldIndex = 0; fieldIndex < mutation.size(); fieldIndex++) { values.add(mutation.get(fieldIndex));
@Override public Row call(Tuple2<Iterable<Row>, Iterable<Row>> cogrouped) throws Exception { // There should only be one 'into' record per key Row intoRow = cogrouped._1().iterator().next(); Row[] fromRows = Iterables.toArray(cogrouped._2(), Row.class); int intoRowNumFields = intoRow.size(); Object[] nestedValues = new Object[intoRowNumFields + 1]; for (int i = 0; i < intoRowNumFields; i++) { nestedValues[i] = intoRow.get(i); } nestedValues[intoRowNumFields] = fromRows; Row nested = RowFactory.create(nestedValues); return nested; } }
/** * Convert a list of rows to a matrix * @param rows the list of rows to convert * @return the converted matrix */ public static INDArray toMatrix(List<Row> rows) { INDArray ret = Nd4j.create(rows.size(), rows.get(0).size()); for (int i = 0; i < ret.rows(); i++) { for (int j = 0; j < ret.columns(); j++) { ret.putScalar(i, j, rows.get(i).getDouble(j)); } } return ret; }
/** * Convert a list of rows to a matrix * @param rows the list of rows to convert * @return the converted matrix */ public static INDArray toMatrix(List<Row> rows) { INDArray ret = Nd4j.create(rows.size(), rows.get(0).size()); for (int i = 0; i < ret.rows(); i++) { for (int j = 0; j < ret.columns(); j++) { ret.putScalar(i, j, rows.get(i).getDouble(j)); } } return ret; }
@Override public List<Writable> call(Row v1) throws Exception { List<Writable> ret = new ArrayList<>(); if (v1.size() != schema.numColumns()) throw new IllegalArgumentException("Invalid number of columns for row " + v1.size() + " should have matched schema columns " + schema.numColumns()); for (int i = 0; i < v1.size(); i++) { if (v1.get(i) == null) throw new IllegalStateException("Row item " + i + " is null"); switch (schema.getType(i)) { case Double: ret.add(new DoubleWritable(v1.getDouble(i))); break; case Float: ret.add(new FloatWritable(v1.getFloat(i))); break; case Integer: ret.add(new IntWritable(v1.getInt(i))); break; case Long: ret.add(new LongWritable(v1.getLong(i))); break; default: throw new IllegalStateException("Illegal type"); } } return ret; } }
@Override public List<Writable> call(Row v1) throws Exception { List<Writable> ret = new ArrayList<>(); if (v1.size() != schema.numColumns()) throw new IllegalArgumentException("Invalid number of columns for row " + v1.size() + " should have matched schema columns " + schema.numColumns()); for (int i = 0; i < v1.size(); i++) { if (v1.get(i) == null) throw new IllegalStateException("Row item " + i + " is null"); switch (schema.getType(i)) { case Double: ret.add(new DoubleWritable(v1.getDouble(i))); break; case Float: ret.add(new FloatWritable(v1.getFloat(i))); break; case Integer: ret.add(new IntWritable(v1.getInt(i))); break; case Long: ret.add(new LongWritable(v1.getLong(i))); break; default: throw new IllegalStateException("Illegal type"); } } return ret; } }
LOGGER.trace("First Row object to be aggregated: {}", v1); LOGGER.trace("Second Row object to be aggregated: {}", v2); ArrayList<Object> outputRow = new ArrayList<>(v1.size()); if (isEntity) { for (final String col : columnToPaths.get(ParquetStoreConstants.VERTEX)) {
for (int i = 0; i < row.size(); i++) { switch (schema.getType(i)) { case Double:
for (int i = 0; i < row.size(); i++) { switch (schema.getType(i)) { case Double:
StructField[] fields = ((StructType) type).fields(); if (fields.length != input.size()) { throw new RuntimeException(String.format("Type[%s] - Invalid size of input Row: %s", type, item));