== Physical Plan ==
* Sort (52)
+- Exchange (51)
   +- * HashAggregate (50)
      +- Exchange (49)
         +- * HashAggregate (48)
            +- * Project (47)
               +- * BroadcastHashJoin Inner BuildRight (46)
                  :- * Project (40)
                  :  +- * BroadcastHashJoin Inner BuildRight (39)
                  :     :- * Project (34)
                  :     :  +- * BroadcastHashJoin Inner BuildRight (33)
                  :     :     :- * Project (28)
                  :     :     :  +- * BroadcastHashJoin Inner BuildRight (27)
                  :     :     :     :- * Project (22)
                  :     :     :     :  +- * BroadcastHashJoin Inner BuildRight (21)
                  :     :     :     :     :- * Project (16)
                  :     :     :     :     :  +- * BroadcastHashJoin Inner BuildRight (15)
                  :     :     :     :     :     :- * Project (10)
                  :     :     :     :     :     :  +- * BroadcastHashJoin Inner BuildRight (9)
                  :     :     :     :     :     :     :- * Project (4)
                  :     :     :     :     :     :     :  +- * Filter (3)
                  :     :     :     :     :     :     :     +- * ColumnarToRow (2)
                  :     :     :     :     :     :     :        +- Scan parquet default.part (1)
                  :     :     :     :     :     :     +- BroadcastExchange (8)
                  :     :     :     :     :     :        +- * Filter (7)
                  :     :     :     :     :     :           +- * ColumnarToRow (6)
                  :     :     :     :     :     :              +- Scan parquet default.lineitem (5)
                  :     :     :     :     :     +- BroadcastExchange (14)
                  :     :     :     :     :        +- * Filter (13)
                  :     :     :     :     :           +- * ColumnarToRow (12)
                  :     :     :     :     :              +- Scan parquet default.supplier (11)
                  :     :     :     :     +- BroadcastExchange (20)
                  :     :     :     :        +- * Filter (19)
                  :     :     :     :           +- * ColumnarToRow (18)
                  :     :     :     :              +- Scan parquet default.orders (17)
                  :     :     :     +- BroadcastExchange (26)
                  :     :     :        +- * Filter (25)
                  :     :     :           +- * ColumnarToRow (24)
                  :     :     :              +- Scan parquet default.customer (23)
                  :     :     +- BroadcastExchange (32)
                  :     :        +- * Filter (31)
                  :     :           +- * ColumnarToRow (30)
                  :     :              +- Scan parquet default.nation (29)
                  :     +- BroadcastExchange (38)
                  :        +- * Filter (37)
                  :           +- * ColumnarToRow (36)
                  :              +- Scan parquet default.nation (35)
                  +- BroadcastExchange (45)
                     +- * Project (44)
                        +- * Filter (43)
                           +- * ColumnarToRow (42)
                              +- Scan parquet default.region (41)


(1) Scan parquet default.part
Output [2]: [p_partkey#1, p_type#2]
Batched: true
Location [not included in comparison]/{warehouse_dir}/part]
PushedFilters: [IsNotNull(p_type), EqualTo(p_type,ECONOMY ANODIZED STEEL), IsNotNull(p_partkey)]
ReadSchema: struct<p_partkey:bigint,p_type:string>

(2) ColumnarToRow [codegen id : 8]
Input [2]: [p_partkey#1, p_type#2]

(3) Filter [codegen id : 8]
Input [2]: [p_partkey#1, p_type#2]
Condition : ((isnotnull(p_type#2) AND (p_type#2 = ECONOMY ANODIZED STEEL)) AND isnotnull(p_partkey#1))

(4) Project [codegen id : 8]
Output [1]: [p_partkey#1]
Input [2]: [p_partkey#1, p_type#2]

(5) Scan parquet default.lineitem
Output [5]: [l_orderkey#3, l_partkey#4, l_suppkey#5, l_extendedprice#6, l_discount#7]
Batched: true
Location [not included in comparison]/{warehouse_dir}/lineitem]
PushedFilters: [IsNotNull(l_partkey), IsNotNull(l_suppkey), IsNotNull(l_orderkey)]
ReadSchema: struct<l_orderkey:bigint,l_partkey:bigint,l_suppkey:bigint,l_extendedprice:decimal(10,0),l_discount:decimal(10,0)>

(6) ColumnarToRow [codegen id : 1]
Input [5]: [l_orderkey#3, l_partkey#4, l_suppkey#5, l_extendedprice#6, l_discount#7]

(7) Filter [codegen id : 1]
Input [5]: [l_orderkey#3, l_partkey#4, l_suppkey#5, l_extendedprice#6, l_discount#7]
Condition : ((isnotnull(l_partkey#4) AND isnotnull(l_suppkey#5)) AND isnotnull(l_orderkey#3))

(8) BroadcastExchange
Input [5]: [l_orderkey#3, l_partkey#4, l_suppkey#5, l_extendedprice#6, l_discount#7]
Arguments: HashedRelationBroadcastMode(List(input[1, bigint, false]),false), [id=#8]

(9) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [p_partkey#1]
Right keys [1]: [l_partkey#4]
Join condition: None

(10) Project [codegen id : 8]
Output [4]: [l_orderkey#3, l_suppkey#5, l_extendedprice#6, l_discount#7]
Input [6]: [p_partkey#1, l_orderkey#3, l_partkey#4, l_suppkey#5, l_extendedprice#6, l_discount#7]

(11) Scan parquet default.supplier
Output [2]: [s_suppkey#9, s_nationkey#10]
Batched: true
Location [not included in comparison]/{warehouse_dir}/supplier]
PushedFilters: [IsNotNull(s_suppkey), IsNotNull(s_nationkey)]
ReadSchema: struct<s_suppkey:bigint,s_nationkey:bigint>

(12) ColumnarToRow [codegen id : 2]
Input [2]: [s_suppkey#9, s_nationkey#10]

(13) Filter [codegen id : 2]
Input [2]: [s_suppkey#9, s_nationkey#10]
Condition : (isnotnull(s_suppkey#9) AND isnotnull(s_nationkey#10))

(14) BroadcastExchange
Input [2]: [s_suppkey#9, s_nationkey#10]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, false]),false), [id=#11]

(15) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [l_suppkey#5]
Right keys [1]: [s_suppkey#9]
Join condition: None

(16) Project [codegen id : 8]
Output [4]: [l_orderkey#3, l_extendedprice#6, l_discount#7, s_nationkey#10]
Input [6]: [l_orderkey#3, l_suppkey#5, l_extendedprice#6, l_discount#7, s_suppkey#9, s_nationkey#10]

(17) Scan parquet default.orders
Output [3]: [o_orderkey#12, o_custkey#13, o_orderdate#14]
Batched: true
Location [not included in comparison]/{warehouse_dir}/orders]
PushedFilters: [IsNotNull(o_orderdate), GreaterThanOrEqual(o_orderdate,1995-01-01), LessThanOrEqual(o_orderdate,1996-12-31), IsNotNull(o_orderkey), IsNotNull(o_custkey)]
ReadSchema: struct<o_orderkey:bigint,o_custkey:bigint,o_orderdate:date>

(18) ColumnarToRow [codegen id : 3]
Input [3]: [o_orderkey#12, o_custkey#13, o_orderdate#14]

(19) Filter [codegen id : 3]
Input [3]: [o_orderkey#12, o_custkey#13, o_orderdate#14]
Condition : ((((isnotnull(o_orderdate#14) AND (o_orderdate#14 >= 1995-01-01)) AND (o_orderdate#14 <= 1996-12-31)) AND isnotnull(o_orderkey#12)) AND isnotnull(o_custkey#13))

(20) BroadcastExchange
Input [3]: [o_orderkey#12, o_custkey#13, o_orderdate#14]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, false]),false), [id=#15]

(21) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [l_orderkey#3]
Right keys [1]: [o_orderkey#12]
Join condition: None

(22) Project [codegen id : 8]
Output [5]: [l_extendedprice#6, l_discount#7, s_nationkey#10, o_custkey#13, o_orderdate#14]
Input [7]: [l_orderkey#3, l_extendedprice#6, l_discount#7, s_nationkey#10, o_orderkey#12, o_custkey#13, o_orderdate#14]

(23) Scan parquet default.customer
Output [2]: [c_custkey#16, c_nationkey#17]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_custkey), IsNotNull(c_nationkey)]
ReadSchema: struct<c_custkey:bigint,c_nationkey:bigint>

(24) ColumnarToRow [codegen id : 4]
Input [2]: [c_custkey#16, c_nationkey#17]

(25) Filter [codegen id : 4]
Input [2]: [c_custkey#16, c_nationkey#17]
Condition : (isnotnull(c_custkey#16) AND isnotnull(c_nationkey#17))

(26) BroadcastExchange
Input [2]: [c_custkey#16, c_nationkey#17]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, false]),false), [id=#18]

(27) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [o_custkey#13]
Right keys [1]: [c_custkey#16]
Join condition: None

(28) Project [codegen id : 8]
Output [5]: [l_extendedprice#6, l_discount#7, s_nationkey#10, o_orderdate#14, c_nationkey#17]
Input [7]: [l_extendedprice#6, l_discount#7, s_nationkey#10, o_custkey#13, o_orderdate#14, c_custkey#16, c_nationkey#17]

(29) Scan parquet default.nation
Output [2]: [n_nationkey#19, n_regionkey#20]
Batched: true
Location [not included in comparison]/{warehouse_dir}/nation]
PushedFilters: [IsNotNull(n_nationkey), IsNotNull(n_regionkey)]
ReadSchema: struct<n_nationkey:bigint,n_regionkey:bigint>

(30) ColumnarToRow [codegen id : 5]
Input [2]: [n_nationkey#19, n_regionkey#20]

(31) Filter [codegen id : 5]
Input [2]: [n_nationkey#19, n_regionkey#20]
Condition : (isnotnull(n_nationkey#19) AND isnotnull(n_regionkey#20))

(32) BroadcastExchange
Input [2]: [n_nationkey#19, n_regionkey#20]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, false]),false), [id=#21]

(33) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [c_nationkey#17]
Right keys [1]: [n_nationkey#19]
Join condition: None

(34) Project [codegen id : 8]
Output [5]: [l_extendedprice#6, l_discount#7, s_nationkey#10, o_orderdate#14, n_regionkey#20]
Input [7]: [l_extendedprice#6, l_discount#7, s_nationkey#10, o_orderdate#14, c_nationkey#17, n_nationkey#19, n_regionkey#20]

(35) Scan parquet default.nation
Output [2]: [n_nationkey#22, n_name#23]
Batched: true
Location [not included in comparison]/{warehouse_dir}/nation]
PushedFilters: [IsNotNull(n_nationkey)]
ReadSchema: struct<n_nationkey:bigint,n_name:string>

(36) ColumnarToRow [codegen id : 6]
Input [2]: [n_nationkey#22, n_name#23]

(37) Filter [codegen id : 6]
Input [2]: [n_nationkey#22, n_name#23]
Condition : isnotnull(n_nationkey#22)

(38) BroadcastExchange
Input [2]: [n_nationkey#22, n_name#23]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, false]),false), [id=#24]

(39) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [s_nationkey#10]
Right keys [1]: [n_nationkey#22]
Join condition: None

(40) Project [codegen id : 8]
Output [5]: [l_extendedprice#6, l_discount#7, o_orderdate#14, n_regionkey#20, n_name#23]
Input [7]: [l_extendedprice#6, l_discount#7, s_nationkey#10, o_orderdate#14, n_regionkey#20, n_nationkey#22, n_name#23]

(41) Scan parquet default.region
Output [2]: [r_regionkey#25, r_name#26]
Batched: true
Location [not included in comparison]/{warehouse_dir}/region]
PushedFilters: [IsNotNull(r_name), EqualTo(r_name,AMERICA), IsNotNull(r_regionkey)]
ReadSchema: struct<r_regionkey:bigint,r_name:string>

(42) ColumnarToRow [codegen id : 7]
Input [2]: [r_regionkey#25, r_name#26]

(43) Filter [codegen id : 7]
Input [2]: [r_regionkey#25, r_name#26]
Condition : ((isnotnull(r_name#26) AND (r_name#26 = AMERICA)) AND isnotnull(r_regionkey#25))

(44) Project [codegen id : 7]
Output [1]: [r_regionkey#25]
Input [2]: [r_regionkey#25, r_name#26]

(45) BroadcastExchange
Input [1]: [r_regionkey#25]
Arguments: HashedRelationBroadcastMode(List(input[0, bigint, true]),false), [id=#27]

(46) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [n_regionkey#20]
Right keys [1]: [r_regionkey#25]
Join condition: None

(47) Project [codegen id : 8]
Output [3]: [year(o_orderdate#14) AS o_year#28, CheckOverflow((promote_precision(cast(l_extendedprice#6 as decimal(11,0))) * promote_precision(CheckOverflow((1 - promote_precision(cast(l_discount#7 as decimal(11,0)))), DecimalType(11,0)))), DecimalType(22,0)) AS volume#29, n_name#23 AS nation#30]
Input [6]: [l_extendedprice#6, l_discount#7, o_orderdate#14, n_regionkey#20, n_name#23, r_regionkey#25]

(48) HashAggregate [codegen id : 8]
Input [3]: [o_year#28, volume#29, nation#30]
Keys [1]: [o_year#28]
Functions [2]: [partial_sum(CASE WHEN (nation#30 = BRAZIL) THEN volume#29 ELSE 0 END), partial_sum(volume#29)]
Aggregate Attributes [4]: [sum#31, isEmpty#32, sum#33, isEmpty#34]
Results [5]: [o_year#28, sum#35, isEmpty#36, sum#37, isEmpty#38]

(49) Exchange
Input [5]: [o_year#28, sum#35, isEmpty#36, sum#37, isEmpty#38]
Arguments: hashpartitioning(o_year#28, 5), ENSURE_REQUIREMENTS, [id=#39]

(50) HashAggregate [codegen id : 9]
Input [5]: [o_year#28, sum#35, isEmpty#36, sum#37, isEmpty#38]
Keys [1]: [o_year#28]
Functions [2]: [sum(CASE WHEN (nation#30 = BRAZIL) THEN volume#29 ELSE 0 END), sum(volume#29)]
Aggregate Attributes [2]: [sum(CASE WHEN (nation#30 = BRAZIL) THEN volume#29 ELSE 0 END)#40, sum(volume#29)#41]
Results [2]: [o_year#28, CheckOverflow((promote_precision(sum(CASE WHEN (nation#30 = BRAZIL) THEN volume#29 ELSE 0 END)#40) / promote_precision(sum(volume#29)#41)), DecimalType(38,6)) AS mkt_share#42]

(51) Exchange
Input [2]: [o_year#28, mkt_share#42]
Arguments: rangepartitioning(o_year#28 ASC NULLS FIRST, 5), ENSURE_REQUIREMENTS, [id=#43]

(52) Sort [codegen id : 10]
Input [2]: [o_year#28, mkt_share#42]
Arguments: [o_year#28 ASC NULLS FIRST], true, 0

