sparksql源碼解析(執行計劃)

這裏寫圖片描述[TOC]

1.group by查詢

select count(*),sum(o_totalprice),o_orderpriority from default.orders where o_orderkey>100 group by o_orderpriority"
== Parsed Logical Plan ==
'Aggregate ['o_orderpriority], [unresolvedalias((count(1),mode=Complete,isDistinct=false)),unresolvedalias('sum('o_totalprice)),unresolvedalias('o_orderpriority)]
+- 'Filter ('o_orderkey > 100)
   +- 'UnresolvedRelation `default`.`orders`, None

== Analyzed Logical Plan ==
_c0: bigint, _c1: double, o_orderpriority: string
Aggregate [o_orderpriority#18], [(count(1),mode=Complete,isDistinct=false) AS _c0#22L,(sum(o_totalprice#16),mode=Complete,isDistinct=false) AS _c1#23,o_orderpriority#18]
+- Filter (o_orderkey#13 > 100)
   +- MetastoreRelation default, orders, None

== Optimized Logical Plan ==
Aggregate [o_orderpriority#18], [(count(1),mode=Complete,isDistinct=false) AS _c0#22L,(sum(o_totalprice#16),mode=Complete,isDistinct=false) AS _c1#23,o_orderpriority#18]
+- Project [o_orderpriority#18,o_totalprice#16]
   +- Filter (o_orderkey#13 > 100)
      +- MetastoreRelation default, orders, None

== Physical Plan ==
TungstenAggregate(key=[o_orderpriority#18], functions=[(count(1),mode=Final,isDistinct=false),(sum(o_totalprice#16),mode=Final,isDistinct=false)], output=[_c0#22L,_c1#23,o_orderpriority#18])
+- TungstenExchange hashpartitioning(o_orderpriority#18,200), None
   +- TungstenAggregate(key=[o_orderpriority#18], functions=[(count(1),mode=Partial,isDistinct=false),(sum(o_totalprice#16),mode=Partial,isDistinct=false)], output=[o_orderpriority#18,count#28L,sum#29])
      +- Project [o_orderpriority#18,o_totalprice#16]
         +- Filter (o_orderkey#13 > 100)
            +- HiveTableScan [o_orderpriority#18,o_totalprice#16,o_orderkey#13], MetastoreRelation default, orders, None
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章