是否可以将窗口化的无界 PCollection 写入特定的 BQ 分区?

Is it possible to write a windowed unbounded PCollection to a specific BQ partition?

给定流式传输中的 Windowed PCollection,我想根据 window 写入 BQ table 中的特定分区。

当为 BigQueryIO.Write.Bound.to(SerializableFunction<BoundedWindow,String> tableSpecFunction) (docs) 指定 tableSpecFunction 时,我似乎只能为 table 参考字符串指定字母数字名称。

没有指定 table 装饰器,数据似乎写入了 __UNPARTITIONED__ 的分区 ID。 AFAICT 这最终将解析为 today's partition.

对于我的用例,我希望可以立即访问正确分区中的数据。此外,能够解决延迟数据并将其写入正确的分区也很棒。

所以重申我的问题:

是否可以将 windowed 无界 PCollection 写入特定的 BQ 分区?

您应该可以直接使用分区名称。 BigQuery API(流式处理)支持使用 table 的分区装饰器写入 table 的给定分区。例如,要为 table T 写入 2016-05-01 的分区,您将使用 T$20160501

<table_name>$<date> 语法不适合你吗?