首页 > 解决方案 > pyspark.sql.utils.IllegalArgumentException:要求失败:尚未设置临时 GCS 路径

问题描述

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

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

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

标签: google-bigquerygoogle-cloud-dataproc

解决方案


正如spark-bigquery-connector的 github存储库所说

写的时候可以指定:

df.write
.format("bigquery")
.option("temporaryGcsBucket","some-bucket")
.save("dataset.table")

或者以全局方式:

spark.conf.set("temporaryGcsBucket","some-bucket")

推荐阅读