如何将 hdfs 文件读入 apache beam?

How to read hdfs files into apache beam?

我无法理解如何使用 TextIO 阅读它。谁能举例说明一下?

尝试以下操作。它适用于我的情况。

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/*"));