【发布时间】:2023-01-08 08:18:31
【问题描述】:
我想在运行数据流作业时动态传递查询。我正在使用 SQLTransform,当我在代码中传递 Query 时它工作正常。
我的用例需要在运行时传递查询,是否可以在 Apache Beam 中使用 SqlTransform?
如果我在代码中对其进行硬编码,这将起作用。
String PQuery = "SELECT col1, max(col2) as max_watermark FROM PCOLLECTION GROUP BY col1";
PCollection<Row> rows1 = rows.apply(SqlTransform.query(PQuery));
但是对于valueProvider 输入,它会给出编译时错误。
PCollection<Row> rows1 = rows.apply(SqlTransform.query(options.getQuery()))
错误
The method query(String) in the type SqlTransform is not applicable for the arguments (ValueProvider<String>)
【问题讨论】:
标签: java google-cloud-dataflow apache-beam