回答

4

您將需要使用TextIO寫入文件(有關所有內置I/O轉換的概述,請看here)。

您可以在代碼here看一個例子:

PCollection<String> lines = ...; 
lines.apply(TextIO.write().to("/path/to/file.txt") 
    .withSuffix(".txt") 
    .withWritableByteChannelFactory(FileBasedSink.CompressionType.GZIP)); 

編輯:您還可以從BigQuery的直接從GUI導出表到一個壓縮文件:enter image description here

+0

不幸的是,谷歌的數據流不提供.withWritableByteChannelFactory() – Sandeep

+0

您準確使用哪個SDK?更新上面的btw代碼。 –

+0

com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:1.9.0 – Sandeep

相關問題