pyspark.sql.utils.IllegalArgumentException:要求失败:尚未设置临时GCS路径

Cod*_*rsa 3 google-bigquery google-cloud-dataproc

在 Google Cloud Platform 上,我尝试提交一个将数据帧写入 BigQuery 的 pyspark 作业。执行写入的代码如下:

finalDF.write.format("bigquery")\
.mode('overwrite')\
.option("table","[PROJECT_ID].dataset.table")\
.save()
Run Code Online (Sandbox Code Playgroud)

我得到了标题中提到的错误。如何设置GCS临时路径?

Cod*_*rsa 7

正如Spark-bigquery-connector 的github存储库所述

写的时候可以指定:

df.write
.format("bigquery")
.option("temporaryGcsBucket","some-bucket")
.save("dataset.table")
Run Code Online (Sandbox Code Playgroud)

或者以全局方式:

spark.conf.set("temporaryGcsBucket","some-bucket")
Run Code Online (Sandbox Code Playgroud)