在 Spark 3.1.1 中,我在 DataFrame 上做了一個沒有不同的 groupBy。我嘗試使用關閉部分聚合
spark.conf.set("spark.sql.aggregate.partialaggregate.skip.enabled", "true")
然后運行查詢
df.groupBy("method").agg(sum("request_body_len"))
Spark 最終仍會進行部分聚合,如物理計劃中所示。
== Physical Plan ==
*(2) HashAggregate(keys=[method#23], functions=[sum(cast(request_body_len#28 as bigint))], output=[method#23, sum(request_body_len)#142L])
- Exchange hashpartitioning(method#23, 200), ENSURE_REQUIREMENTS, [id=#58]
- *(1) HashAggregate(keys=[method#23], functions=[partial_sum(cast(request_body_len#28 as bigint))], output=[method#23, sum#146L])
- FileScan csv [method#23,request_body_len#28] Batched: false, DataFilters: [], Format: CSV, Location: InMemoryFileIndex[file:/mnt/http.csv], PartitionFilters: [], PushedFilters: [], ReadSchema: struct<method:string,request_body_len:int>
我在 Youtube 上觀看了這個視頻后嘗試了這個:https : //youtu.be/_Ne27JcLnEc @56:53
最新的 Spark 中是否不再提供此功能,還是我遺漏了什么?
uj5u.com熱心網友回復:
spark.sql.aggregate.partialaggregate.skip.enabledspark源代碼中不存在該配置。
所有的spark.sql.*配置都在 SQLConf 物件中定義(這個不存在):https :
//github.com/apache/spark/blob/651904a2ef57d2261ea6e256e4f3cdd26aa1b69d/sql/catalyst/src/main/scala/org/apache/spark/ sql/內部/SQLConf.scala
據我檢查,此配置在以前的版本中也不可用。
在您分享的視頻中,在相關幻燈片中有一個 PR 鏈接,可以跳過部分聚合,但似乎沒有合并。
spark 專案有一個 PR 解決了這個問題并添加了這個配置(也許這與視頻中呈現的 PR 相同,我不知道)但它已關閉:https : //github.com/apache /火花/拉/ 28804
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/316049.html
