use of com.alibaba.alink.operator.stream.dataproc.FlattenMTableStreamOp in project Alink by alibaba.
the class FlattenMTableTest method test3.
@Test
public void test3() throws Exception {
List<Row> rows = new ArrayList<>();
rows.add(Row.of("a1", "{\"data\":{\"f0\":[\"11L\",\"12L\"],\"f1\":[2.0,2.0]},\"schema\":\"f0 VARCHAR,f1 " + "DOUBLE\"}"));
rows.add(Row.of("a3", "{\"data\":{\"f0\":[\"13L\",\"14L\"],\"f1\":[2.0,2.0]},\"schema\":\"f0 VARCHAR,f1 " + "DOUBLE\"}"));
StreamOperator<?> input = new MemSourceStreamOp(rows, "id string, mt string");
FlattenMTableStreamOp flatten = new FlattenMTableStreamOp().setReservedCols("id").setSelectedCol("mt").setSchemaStr("f0 string, f1 int");
CollectSinkStreamOp sop = flatten.linkFrom(input).link(new CollectSinkStreamOp());
StreamOperator.execute();
List<Row> res = sop.getAndRemoveValues();
for (Row row : res) {
Assert.assertEquals(2, row.getField(2));
}
}
Aggregations