使用 Spark Big Query Connector 的自定义 SQL [英] Custom SQL using Spark Big Query Connector
本文介绍了使用 Spark Big Query Connector 的自定义 SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些自定义 sql 可以从 BigQuery 读取数据.我该如何执行?我尝试使用选项作为查询,但它不起作用.它忽略查询选项并读取完整表.
I have some custom sql to read the data from BigQuery. How can I execute that? I tried using option as query but it is not working. It is ignoring the query option and reading the full table.
Dataset<Row> testDS = session.read().format("bigquery")
//.option("table", <TABLE>)
.option("query",<QUERY>)
.option("project", <PROJECT_ID>)
.option("parentProject", <PROJECT_ID>)
.load();
推荐答案
那是因为 query
选项在连接器中不可用.请参阅 https://github.com/GoogleCloudDataproc/spark-bigquery-connector/README.md 获取完整的选项列表.
That's because the query
option is not available in the connector. See https://github.com/GoogleCloudDataproc/spark-bigquery-connector/README.md for a full list of options.
您有几个选择:
- 使用您的自定义 SQL 创建一个视图,并从该视图中读取
- 使用查询结果创建一个临时表,读取这些结果,然后删除该表.
这篇关于使用 Spark Big Query Connector 的自定义 SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文