簡體   English   中英

有沒有更好的方法通過PySpark集群(dataporc)將spark df加載到BigQuery中?

[英]Is there a better way to load a spark df into BigQuery through PySpark cluster (dataporc)?

我目前正在使用以下代碼通過 PySpark 集群 (dataproc) 將數據加載到 BigQuery 中,但處理時間太長或因執行時間超出錯誤而終止。 有沒有更好更快的方法將 spark df 加載到 BigQuery 中?

output.write \
      .format("bigquery") \
      .option("table","{}.{}".format(bq_dataset, bq_table)) \
      .option("temporaryGcsBucket", gcs_bucket) \
      .mode('append') \
      .save()

下面是我的 dataproc 集群配置:

Master node : Standard (1 master, N workers)
Machine type : n1-standard-4
Number of GPUs : 0
Primary disk type : pd-standard
Primary disk size : 500GB
Worker nodes : 3
Machine type : n1-standard-4
Number of GPUs : 0
Primary disk type : pd-standard
Primary disk size : 500GB
Image version : 1.4.30-ubuntu18

請確保您使用的是最新版本的 SparkBigQueryConnector。

嘗試使用其他中間格式測試您的代碼,例如 avro、orc 和 parquet。 Avro 傾向於在處理更大的數據時表現更好。

如果您正在寫入的數據非常龐大,請嘗試添加更多工作人員或選擇不同的機器類型。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM