簡體   English   中英

加入 scala 火花時出錯。 org.apache.spark.sql.AnalysisException:缺少解析的屬性

[英]Error with join in scala spark. org.apache.spark.sql.AnalysisException: Resolved attribute(s) missing

連接兩個數據幀在 Scala Spark 中引發了一個相當奇怪的錯誤。 我正在嘗試加入兩個數據集,即輸入度量

我正在執行的片段->

input.as("input").join(broadcast(metric.as("metric"), Seq("seller","seller_seller_tag"), "left_outer"))

加入中斷 ->

org.apache.spark.sql.AnalysisException: Resolved attribute(s) seller_seller_tag#2763 missing from seller#2483, seller_tag#2484, stats_date#2507, learner_id#2508, keyword_click#2493L, visible_impression#2494L, seller_tag_misc#439 in operator +- !Aggregate [seller#2483, seller_seller_tag#2763], [seller#2483, seller_seller_tag#2763, sum(visible_impression#2494L) AS visible_impression#527L, sum(keyword_click#2493L) AS keyword_click#529L]. Attribute(s) with the same name appear in the operation: seller_seller_tag. Please check if the right attribute(s) are used.;;

我已經斷言這兩個數據框都有 seller_seller_tag 列。

怪異->

這是公制https://dpaste.com/7NECV5DWX的邏輯計划

這是輸入https://dpaste.com/DYSGLUWCY的邏輯計划

這是加入https://dpaste.com/AGH2BCN2G的邏輯計划

在加入計划中,seller_seller_tag 的#id 列突然發生變化,指標為 dataframe ->

+- !Aggregate [seller#2483, seller_seller_tag#2763], [seller#2483, seller_seller_tag#2763, sum(visible_impression#2494L) AS visible_impression#527L, sum(keyword_click#2493L) AS keyword_click#529L]
+- Project [seller#2483, seller_tag#2484, stats_date#2507, learner_id#2508, keyword_click#2493L, visible_impression#2494L, seller_tag_misc#439, concat(seller#2483, __, seller_tag_misc#439) AS seller_seller_tag#482]

而指標計划中的相同步驟是->

+- Aggregate [seller#2483, seller_seller_tag#482], [seller#2483, seller_seller_tag#482, sum(visible_impression#2494L) AS visible_impression#527L, sum(keyword_click#2493L) AS keyword_click#529L]
+- Project [seller#2483, seller_tag#2484, stats_date#2507, learner_id#2508, keyword_click#2493L, visible_impression#2494L, seller_tag_misc#439, concat(seller#2483, __, seller_tag_misc#439) AS seller_seller_tag#482]

該計划在加入時更改 ID? 解釋!?

這是 spark 2.4.0 的錯誤(可能更小,不確定)。 即使 SQL 看起來合法,當您的查詢有多個連接時,也會拋出AnalysisException 發生這種情況是因為ResolveReferences.dedupRight是 spark 在解決計划的過程中使用的內部方法。 感謝mazaneicha指出這一點。 您可以從這里了解更多關於這個問題的信息並重現它https://issues.apache.org/jira/plugins/servlet/mobile#issue/SPARK-32280

該問題已在較高版本的 spark(2.4.7、3.0.1、3.1.0)中修復。 https://issues.apache.org/jira/browse/SPARK-32280?attachmentSortBy=dateTime

暫無
暫無

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

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