如何使用 Livy 在 Dataproc 中包含 BigQuery Connector

How to include BigQuery Connector inside Dataproc using Livy

我正在尝试 运行 我的应用程序使用驻留在 GCP Dataproc 中的 Livy,但我得到了这个:“由以下原因引起:java.lang.ClassNotFoundException:bigquery.DefaultSource

我能够 运行 hadoop fs -ls gs://xxxx 在 Dataproc 中并且我检查了 Spark 是否指向正确的位置以便找到 gcs-connector.jar 也可以。

我使用初始化将 Livy 包含在 Dataproc 中 (https://github.com/GoogleCloudDataproc/initialization-actions/blob/master/livy/)

如何在 Livy 的类路径中包含 bigquery-connector? 请问你能帮帮我吗? 谢谢大家!

您的应用程序似乎依赖于 BigQuery 连接器,而不是 GCS 连接器 (bigquery.DefaultSource)。

默认情况下,GCS 连接器应始终包含在 HADOOP 类路径中,但您必须手动将 BigQuery 连接器 jar 添加到您的应用程序。

假设这是一个 Spark 应用程序,您可以将 Spark jar 属性 设置为在运行时从 GCS 中提取 bigquery 连接器 jar:spark.jars='gs://spark-lib/bigquery/spark-bigquery-latest_2.12.jar'

有关更多安装选项,请参阅 https://github.com/GoogleCloudDataproc/spark-bigquery-connector/blob/master/README.md