@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { Map<String, Object> toJson = new HashMap<>(); for (Pair<String, Object> entry : row.getFields()) { toJson.put(entry.getFirst(), entry.getSecond()); } row.addOrSet(column, gson.toJson(toJson)); } return rows; } }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { int idx = 0; for (Pair<String, Object> v : row.getFields()) { if (!keep.contains(v.getFirst())) { row.remove(idx); } else { ++idx; } } } return rows; } }
for (Pair<String, Object> column : row.getFields()) { String name = column.getFirst(); Object value = column.getSecond();
if (row.getFields().size() == 1) { Object cell = row.getValue(0); if (cell instanceof StructuredRecord) {