【发布时间】:2018-04-19 07:34:34
【问题描述】:
我们正在尝试使用 Apache Beam 和 avro 写入 Big Query。
以下似乎工作正常:-
p.apply("Input", AvroIO.read(DataStructure.class).from("AvroSampleFile.avro"))
.apply("Transform", ParDo.of(new CustomTransformFunction()))
.apply("Load", BigQueryIO.writeTableRows().to(table).withSchema(schema));
然后我们尝试通过以下方式使用它从 Google Pub/Sub 获取数据
p.begin()
.apply("Input", PubsubIO.readAvros(DataStructure.class).fromTopic("topicName"))
.apply("Transform", ParDo.of(new CustomTransformFunction()))
.apply("Write", BigQueryIO.writeTableRows()
.to(table)
.withSchema(schema)
.withTimePartitioning(timePartitioning)
.withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_IF_NEEDED)
.withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND));
p.run().waitUntilFinish();
当我们这样做时,它总是将它推送到缓冲区,Big Query 似乎需要很长时间才能从缓冲区中读取。谁能告诉我为什么上面不会将记录直接写入 Big Query 表?
更新:- 看起来我需要添加以下设置,但这会引发 java.lang.IllegalArgumentException。
.withMethod(Method.FILE_LOADS)
.withTriggeringFrequency(org.joda.time.Duration.standardMinutes(2))
【问题讨论】:
标签: google-bigquery apache-beam