@Override public Row get() { Row row = new Row(); for (Map.Entry<String, Object> entry : map.entrySet()) { row.add(entry.getKey(), entry.getValue()); } return row; }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException, ErrorRowException { List<Row> results = new ArrayList<>(); for (Row row : rows) { int idx = row.find(column); if (idx == -1) { continue; } Object object = row.getValue(idx); if (object instanceof String) { String body = (String) object; String[] lines = body.split(delimiter); int i = 0; for (String line : lines) { if (i > limit) { break; } results.add(new Row(column, line)); i++; } } } return results; } }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { List<Row> results = new ArrayList<>(); for (Row row : rows) { int idx = row.find(column); if (idx != -1) { Object object = row.getValue(idx); if (object != null && object instanceof String) { String[] lines = ((String) object).split(regex); for (String line : lines) { Row r = new Row(row); r.setValue(idx, line); results.add(r); } } else { throw new DirectiveExecutionException( String.format("%s : Invalid type '%s' of column '%s'. Should be of type String.", toString(), object != null ? object.getClass().getName() : "null", column) ); } } } return results; } }
@Override public List<Row> decode(byte[] bytes) throws DecoderException { List<Row> rows = new ArrayList<>(); try { DynamicMessage message = DynamicMessage.parseFrom(descriptor, bytes); Row row = new Row(); decodeMessage(message, row, null); rows.add(row); } catch (InvalidProtocolBufferException e) { throw new DecoderException(e.getMessage()); } return rows; }
List<Row> results = new ArrayList<>(); for (Row row : rows) { Row dt = new Row(row); int idx = dt.find(column);
Row newRow = new Row(row); int recPosition = index; int colid = 1;
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { List<Row> results = new ArrayList<>(); for (Row row : rows) { Row masked = new Row(row); int idx = row.find(column); if (idx != -1) { masked.setValue(idx, maskShuffle((String) row.getValue(idx), 0)); } else { throw new DirectiveExecutionException(toString() + " : '" + column + "' column is not defined. Please check the wrangling step." ); } results.add(masked); } return results; }
for (int i = 0; i < array.size(); ++i) { JsonElement object = array.get(i); Row newRow = new Row(row); newRow.add(column, getValue(object)); results.add(newRow);
GenericRecord gRecord = getReader().read(null, decoder); List<Schema.Field> fields = getSchema().getFields(); Row r = new Row(); for (Schema.Field field : fields) { Object object = gRecord.get(field.name());
GenericRecord gRecord = getReader().read(null, decoder); List<Schema.Field> fields = getSchema().getFields(); Row r = new Row(); for (Schema.Field field : fields) { Object object = gRecord.get(field.name());
new DataFileReader<>(new SeekableByteArrayInput((byte[]) object), new GenericDatumReader<>()); while(reader.hasNext()) { Row newRow = new Row(); add(reader.next(), newRow, null); results.add(newRow);
Row r = new Row(row); for (int i = 0; i < count; ++i) { if (locations[i] != -1) {
Row rowTypes = new Row(); for (String column : types.getColumns()) { rowTypes.add(column, types.percentage(column, count)); Row rowStats = new Row(); for (String column : stats.getColumns()) { rowStats.add(column, stats.percentage(column, count)); Row row = new Row(); row.add("types", rowTypes); row.add("stats", rowStats);
Row newRow = new Row(); newRow.add("fwd", rows);