[英]write a apache crunch Pcollection to multiple output files
我有一個緊縮的 dofn 生成一個 Pcollection,當前我將 pcollection 寫入單個 avro 文件我想將 Pcollection 寫入多個文件。
PCollection<String> generatedResults = results.parallelDo(new AvroGeneratorDofn(count),Avros.specifics(String.class));
//generatedResults.write(To.avroFile(outputPath));
pipeline.write(generatedResults,new AvroFileTarget(outputPath), Target.WriteMode.APPEND);
相同的 PCollection 可以寫入任意數量的目標,
generatedResults.write(To.avroFile(outputPath));
generatedResults.write(new AvroFileTarget(outputPath), Target.WriteMode.APPEND);
請參閱Apache 緊縮 - 入門:
正如單個 Pipeline 實例可以從多個 Source 讀取數據一樣,Pipeline 也可以為每個 PCollection 寫入多個輸出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.