我是apache crunch的新手,正在寻找在apache crunch中读取和写入Parquet文件。我遵循了文档和API,但没有得到做同样事情的直接方法。
PCollection<String> pipeLine = MemPipeline.collectionOf("Pineapple", "Banana", "Orange");
PCollection<Integer> b = pipeLine.parallelDo(new DoFn<String, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public void process(String input, Emitter<Integer> emitter) {
emitter.emit(input.length());
}
}, ints());
b.write(new AvroParquetFileTarget("D:\\Tutorials\\CCP_WorkSpace\\Crunch\\resources\\output"));提前谢谢。
发布于 2017-05-13 02:02:20
如果您有一个avro方案和一个来自avro的已编译类,其中包含与您的宗地数据相同的结构,则可以按以下方式读取它
AvroParquetFileSource<MyClassCompiled> avroParquetFileSource =
new AvroParquetFileSource<MyClassCompiled>(
new Path(input), Avros.records(MyClassCompiled.class)
);像这样写拼花
Target parquetFileTarget = new AvroParquetFileTarget(outputPath);
mypcollection.write(avroParquetFileSource);https://stackoverflow.com/questions/42525318
复制相似问题