【问题标题】:How do I write compressed files to Google Cloud Storage using Google Cloud Dataflow?如何使用 Google Cloud Dataflow 将压缩文件写入 Google Cloud Storage?
【发布时间】:2015-07-13 03:58:03
【问题描述】:

我正在尝试将 Gzipped 文件写入 Google Dataflow 程序中的 Google Cloud Storage 存储桶。常见问题解答说

Does the TextIO source and sink support compressed files, such as GZip?
Yes. Cloud Dataflow can read files compressed with gzip and bzip2.

这是否意味着它们不支持编写 GZip 文件?

【问题讨论】:

    标签: google-cloud-dataflow


    【解决方案1】:

    正确,我们目前没有对编写 gzip 文件的内置支持。 但是,user-defined data format API,尤其是FileBasedSink,应该让您自己编写这样的接收器变得简单。

    【讨论】:

    【解决方案2】:

    在新的 Beam 库中,您现在可以更轻松地做到这一点:

    PDone d = c2.apply(TextIO.write()
      .to("gs://path")
      .withWritableByteChannelFactory(FileBasedSink.CompressionType.GZIP));
    

    【讨论】:

      猜你喜欢
      • 2015-08-01
      • 2012-01-02
      • 2018-09-07
      • 1970-01-01
      • 1970-01-01
      • 2020-05-05
      • 2023-03-16
      • 2021-07-27
      • 1970-01-01
      相关资源
      最近更新 更多