gpt4 book ai didi

java - Text.IO.ReadAll 的示例代码

转载 作者:行者123 更新时间:2023-12-02 11:21:34 27 4
gpt4 key购买 nike

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

找到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 个文件。

最佳答案

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

关于java - Text.IO.ReadAll 的示例代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49883978/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com