カスケードを使用してファイルを読み込み、特定のフィールドでグループ化を使用しようとしています。カスケーディング - フィールド名によるグループ化
しかし、ソースファイルのすべての行が返されます。
ソースファイル:
no,date,amt
1,3/10/2016,1000
1,3/10/2016,2000
1,3/11/2016,400
232,2/10/2016,1500
コード:
Fields tscnFields = new Fields("no", "date", "amt");
FileTap tscnFileTap = new FileTap(new TextDelimited(tscnFields,true, ","), "C://Users//Test//tscn.txt");
final Fields groupField = new Fields("date");
Pipe pipe = new Pipe("test");
pipe = new Each(pipe, new Debug());
pipe = new GroupBy("group by date", pipe, groupField);
Fields outFields = new Fields("no", "date", "amt");
FileTap sinkTap = new FileTap(new TextDelimited(outFields,true, ","), "C://Users//Test//out.txt", SinkMode.REPLACE); Flow flow = flowConnector.connect("FlowMonitorTest", tscnFileTap, sinkTap, pipe);
flow.complete();
あなたは下記のような出力をしたい場合、私は取得しています出力は
['1', '3/10/2016', '1000']
['1', '3/10/2016', '2000']
['1', '3/11/2016', '400']
['232', '2/10/2016', '1500']
tuples count: 4
どのような出力が必要ですか? –