有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

文本的java示例代码。木卫一。ReadAll

我必须将30GCS文件夹中的json文件作为字符串读取到数据流管道中。我希望使用Text.IO.ReadAll,而不是为每个步骤添加Text.IO.Read步骤。有什么想法我可以设置它从多个文件夹阅读

找到this,但在我的示例中,文件夹的名称位于List<String>而不是PCollection<String>

// E.g. the filenames might be computed from other data in the pipeline, or
 // read from a data source.
 PCollection<String> filenames = ...;

 // Read all files in the collection.
 PCollection<String> lines = filenames.apply(TextIO.readAll());

我必须阅读的每个GCS文件夹都有500个文件


共 (1) 个答案

  1. # 1 楼答案

    使用Create。of()从列表中创建PCollection