简体   繁体   English

如何将hdfs文件读入apache梁?

[英]How to read hdfs files into apache beam?

I'm not able to understand how to read it with TextIO.我无法理解如何使用 TextIO 阅读它。 Can anyone please explain it with examples?谁能用例子解释一下?

Try the following.请尝试以下操作。 It worked in my case.它在我的情况下有效。

String[] args1 = new String[] {
    "--hdfsConfiguration=[{\"fs.defaultFS\":\"hdfs://localhost:9000\"}]" };

HadoopFileSystemOptions options =
    PipelineOptionsFactory.fromArgs(args1).withValidation().as(
        HadoopFileSystemOptions.class);

Pipeline pipeline = Pipeline.create(options);
pipeline.apply(
    TextIO.read().from("hdfs://localhost:9000/path-to-file/*"));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM