如何使用新的 UDF 功能来创建“动态 SQL 语句”? 有没有办法使用 UDF 来构造基于模板和输入变量的 SQL 语句,然后运行此查询?
最佳答案
文档 https://cloud.google.com/bigquery/user-defined-functions?hl=en说:
A UDF is similar to the "Map" function in a MapReduce: it takes a single row as input and produces zero or more rows as output. The output can potentially have a different schema than the input.
因此您的 UDF 仅接收一行。 因此 - 不,UDF 不适用于您在问题中描述的目的。
您可能会看一下 View - 也许这更适合您: https://cloud.google.com/bigquery/querying-data#views
关于google-bigquery - 我如何使用新的 UDF 功能来创建 "Dynamic SQL statement"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32421890/