== Physical Plan ==
TakeOrderedAndProject (63)
+- * HashAggregate (62)
   +- Exchange (61)
      +- * HashAggregate (60)
         +- Union (59)
            :- * HashAggregate (28)
            :  +- Exchange (27)
            :     +- * HashAggregate (26)
            :        +- * Project (25)
            :           +- * BroadcastHashJoin Inner BuildRight (24)
            :              :- * Project (13)
            :              :  +- * BroadcastHashJoin Inner BuildRight (12)
            :              :     :- * Project (6)
            :              :     :  +- * BroadcastHashJoin Inner BuildRight (5)
            :              :     :     :- * Filter (3)
            :              :     :     :  +- * ColumnarToRow (2)
            :              :     :     :     +- Scan parquet default.store_sales (1)
            :              :     :     +- ReusedExchange (4)
            :              :     +- BroadcastExchange (11)
            :              :        +- * Project (10)
            :              :           +- * Filter (9)
            :              :              +- * ColumnarToRow (8)
            :              :                 +- Scan parquet default.customer_address (7)
            :              +- BroadcastExchange (23)
            :                 +- * BroadcastHashJoin LeftSemi BuildRight (22)
            :                    :- * Filter (16)
            :                    :  +- * ColumnarToRow (15)
            :                    :     +- Scan parquet default.item (14)
            :                    +- BroadcastExchange (21)
            :                       +- * Project (20)
            :                          +- * Filter (19)
            :                             +- * ColumnarToRow (18)
            :                                +- Scan parquet default.item (17)
            :- * HashAggregate (43)
            :  +- Exchange (42)
            :     +- * HashAggregate (41)
            :        +- * Project (40)
            :           +- * BroadcastHashJoin Inner BuildRight (39)
            :              :- * Project (37)
            :              :  +- * BroadcastHashJoin Inner BuildRight (36)
            :              :     :- * Project (34)
            :              :     :  +- * BroadcastHashJoin Inner BuildRight (33)
            :              :     :     :- * Filter (31)
            :              :     :     :  +- * ColumnarToRow (30)
            :              :     :     :     +- Scan parquet default.catalog_sales (29)
            :              :     :     +- ReusedExchange (32)
            :              :     +- ReusedExchange (35)
            :              +- ReusedExchange (38)
            +- * HashAggregate (58)
               +- Exchange (57)
                  +- * HashAggregate (56)
                     +- * Project (55)
                        +- * BroadcastHashJoin Inner BuildRight (54)
                           :- * Project (52)
                           :  +- * BroadcastHashJoin Inner BuildRight (51)
                           :     :- * Project (49)
                           :     :  +- * BroadcastHashJoin Inner BuildRight (48)
                           :     :     :- * Filter (46)
                           :     :     :  +- * ColumnarToRow (45)
                           :     :     :     +- Scan parquet default.web_sales (44)
                           :     :     +- ReusedExchange (47)
                           :     +- ReusedExchange (50)
                           +- ReusedExchange (53)


(1) Scan parquet default.store_sales
Output [4]: [ss_item_sk#1, ss_addr_sk#2, ss_ext_sales_price#3, ss_sold_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#4), dynamicpruningexpression(ss_sold_date_sk#4 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(ss_addr_sk), IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_item_sk:int,ss_addr_sk:int,ss_ext_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 5]
Input [4]: [ss_item_sk#1, ss_addr_sk#2, ss_ext_sales_price#3, ss_sold_date_sk#4]

(3) Filter [codegen id : 5]
Input [4]: [ss_item_sk#1, ss_addr_sk#2, ss_ext_sales_price#3, ss_sold_date_sk#4]
Condition : (isnotnull(ss_addr_sk#2) AND isnotnull(ss_item_sk#1))

(4) ReusedExchange [Reuses operator id: 68]
Output [1]: [d_date_sk#6]

(5) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_sold_date_sk#4]
Right keys [1]: [d_date_sk#6]
Join condition: None

(6) Project [codegen id : 5]
Output [3]: [ss_item_sk#1, ss_addr_sk#2, ss_ext_sales_price#3]
Input [5]: [ss_item_sk#1, ss_addr_sk#2, ss_ext_sales_price#3, ss_sold_date_sk#4, d_date_sk#6]

(7) Scan parquet default.customer_address
Output [2]: [ca_address_sk#7, ca_gmt_offset#8]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_address]
PushedFilters: [IsNotNull(ca_gmt_offset), EqualTo(ca_gmt_offset,-5.00), IsNotNull(ca_address_sk)]
ReadSchema: struct<ca_address_sk:int,ca_gmt_offset:decimal(5,2)>

(8) ColumnarToRow [codegen id : 2]
Input [2]: [ca_address_sk#7, ca_gmt_offset#8]

(9) Filter [codegen id : 2]
Input [2]: [ca_address_sk#7, ca_gmt_offset#8]
Condition : ((isnotnull(ca_gmt_offset#8) AND (ca_gmt_offset#8 = -5.00)) AND isnotnull(ca_address_sk#7))

(10) Project [codegen id : 2]
Output [1]: [ca_address_sk#7]
Input [2]: [ca_address_sk#7, ca_gmt_offset#8]

(11) BroadcastExchange
Input [1]: [ca_address_sk#7]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#9]

(12) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_addr_sk#2]
Right keys [1]: [ca_address_sk#7]
Join condition: None

(13) Project [codegen id : 5]
Output [2]: [ss_item_sk#1, ss_ext_sales_price#3]
Input [4]: [ss_item_sk#1, ss_addr_sk#2, ss_ext_sales_price#3, ca_address_sk#7]

(14) Scan parquet default.item
Output [2]: [i_item_sk#10, i_item_id#11]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_item_id:string>

(15) ColumnarToRow [codegen id : 4]
Input [2]: [i_item_sk#10, i_item_id#11]

(16) Filter [codegen id : 4]
Input [2]: [i_item_sk#10, i_item_id#11]
Condition : isnotnull(i_item_sk#10)

(17) Scan parquet default.item
Output [2]: [i_item_id#12, i_color#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [In(i_color, [blanched            ,burnished           ,slate               ])]
ReadSchema: struct<i_item_id:string,i_color:string>

(18) ColumnarToRow [codegen id : 3]
Input [2]: [i_item_id#12, i_color#13]

(19) Filter [codegen id : 3]
Input [2]: [i_item_id#12, i_color#13]
Condition : i_color#13 IN (slate               ,blanched            ,burnished           )

(20) Project [codegen id : 3]
Output [1]: [i_item_id#12]
Input [2]: [i_item_id#12, i_color#13]

(21) BroadcastExchange
Input [1]: [i_item_id#12]
Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#14]

(22) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [i_item_id#11]
Right keys [1]: [i_item_id#12]
Join condition: None

(23) BroadcastExchange
Input [2]: [i_item_sk#10, i_item_id#11]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#15]

(24) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#10]
Join condition: None

(25) Project [codegen id : 5]
Output [2]: [ss_ext_sales_price#3, i_item_id#11]
Input [4]: [ss_item_sk#1, ss_ext_sales_price#3, i_item_sk#10, i_item_id#11]

(26) HashAggregate [codegen id : 5]
Input [2]: [ss_ext_sales_price#3, i_item_id#11]
Keys [1]: [i_item_id#11]
Functions [1]: [partial_sum(UnscaledValue(ss_ext_sales_price#3))]
Aggregate Attributes [1]: [sum#16]
Results [2]: [i_item_id#11, sum#17]

(27) Exchange
Input [2]: [i_item_id#11, sum#17]
Arguments: hashpartitioning(i_item_id#11, 5), ENSURE_REQUIREMENTS, [id=#18]

(28) HashAggregate [codegen id : 6]
Input [2]: [i_item_id#11, sum#17]
Keys [1]: [i_item_id#11]
Functions [1]: [sum(UnscaledValue(ss_ext_sales_price#3))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_ext_sales_price#3))#19]
Results [2]: [i_item_id#11, MakeDecimal(sum(UnscaledValue(ss_ext_sales_price#3))#19,17,2) AS total_sales#20]

(29) Scan parquet default.catalog_sales
Output [4]: [cs_bill_addr_sk#21, cs_item_sk#22, cs_ext_sales_price#23, cs_sold_date_sk#24]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#24), dynamicpruningexpression(cs_sold_date_sk#24 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(cs_bill_addr_sk), IsNotNull(cs_item_sk)]
ReadSchema: struct<cs_bill_addr_sk:int,cs_item_sk:int,cs_ext_sales_price:decimal(7,2)>

(30) ColumnarToRow [codegen id : 11]
Input [4]: [cs_bill_addr_sk#21, cs_item_sk#22, cs_ext_sales_price#23, cs_sold_date_sk#24]

(31) Filter [codegen id : 11]
Input [4]: [cs_bill_addr_sk#21, cs_item_sk#22, cs_ext_sales_price#23, cs_sold_date_sk#24]
Condition : (isnotnull(cs_bill_addr_sk#21) AND isnotnull(cs_item_sk#22))

(32) ReusedExchange [Reuses operator id: 68]
Output [1]: [d_date_sk#25]

(33) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_sold_date_sk#24]
Right keys [1]: [d_date_sk#25]
Join condition: None

(34) Project [codegen id : 11]
Output [3]: [cs_bill_addr_sk#21, cs_item_sk#22, cs_ext_sales_price#23]
Input [5]: [cs_bill_addr_sk#21, cs_item_sk#22, cs_ext_sales_price#23, cs_sold_date_sk#24, d_date_sk#25]

(35) ReusedExchange [Reuses operator id: 11]
Output [1]: [ca_address_sk#26]

(36) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_bill_addr_sk#21]
Right keys [1]: [ca_address_sk#26]
Join condition: None

(37) Project [codegen id : 11]
Output [2]: [cs_item_sk#22, cs_ext_sales_price#23]
Input [4]: [cs_bill_addr_sk#21, cs_item_sk#22, cs_ext_sales_price#23, ca_address_sk#26]

(38) ReusedExchange [Reuses operator id: 23]
Output [2]: [i_item_sk#27, i_item_id#28]

(39) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_item_sk#22]
Right keys [1]: [i_item_sk#27]
Join condition: None

(40) Project [codegen id : 11]
Output [2]: [cs_ext_sales_price#23, i_item_id#28]
Input [4]: [cs_item_sk#22, cs_ext_sales_price#23, i_item_sk#27, i_item_id#28]

(41) HashAggregate [codegen id : 11]
Input [2]: [cs_ext_sales_price#23, i_item_id#28]
Keys [1]: [i_item_id#28]
Functions [1]: [partial_sum(UnscaledValue(cs_ext_sales_price#23))]
Aggregate Attributes [1]: [sum#29]
Results [2]: [i_item_id#28, sum#30]

(42) Exchange
Input [2]: [i_item_id#28, sum#30]
Arguments: hashpartitioning(i_item_id#28, 5), ENSURE_REQUIREMENTS, [id=#31]

(43) HashAggregate [codegen id : 12]
Input [2]: [i_item_id#28, sum#30]
Keys [1]: [i_item_id#28]
Functions [1]: [sum(UnscaledValue(cs_ext_sales_price#23))]
Aggregate Attributes [1]: [sum(UnscaledValue(cs_ext_sales_price#23))#32]
Results [2]: [i_item_id#28, MakeDecimal(sum(UnscaledValue(cs_ext_sales_price#23))#32,17,2) AS total_sales#33]

(44) Scan parquet default.web_sales
Output [4]: [ws_item_sk#34, ws_bill_addr_sk#35, ws_ext_sales_price#36, ws_sold_date_sk#37]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#37), dynamicpruningexpression(ws_sold_date_sk#37 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(ws_bill_addr_sk), IsNotNull(ws_item_sk)]
ReadSchema: struct<ws_item_sk:int,ws_bill_addr_sk:int,ws_ext_sales_price:decimal(7,2)>

(45) ColumnarToRow [codegen id : 17]
Input [4]: [ws_item_sk#34, ws_bill_addr_sk#35, ws_ext_sales_price#36, ws_sold_date_sk#37]

(46) Filter [codegen id : 17]
Input [4]: [ws_item_sk#34, ws_bill_addr_sk#35, ws_ext_sales_price#36, ws_sold_date_sk#37]
Condition : (isnotnull(ws_bill_addr_sk#35) AND isnotnull(ws_item_sk#34))

(47) ReusedExchange [Reuses operator id: 68]
Output [1]: [d_date_sk#38]

(48) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [ws_sold_date_sk#37]
Right keys [1]: [d_date_sk#38]
Join condition: None

(49) Project [codegen id : 17]
Output [3]: [ws_item_sk#34, ws_bill_addr_sk#35, ws_ext_sales_price#36]
Input [5]: [ws_item_sk#34, ws_bill_addr_sk#35, ws_ext_sales_price#36, ws_sold_date_sk#37, d_date_sk#38]

(50) ReusedExchange [Reuses operator id: 11]
Output [1]: [ca_address_sk#39]

(51) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [ws_bill_addr_sk#35]
Right keys [1]: [ca_address_sk#39]
Join condition: None

(52) Project [codegen id : 17]
Output [2]: [ws_item_sk#34, ws_ext_sales_price#36]
Input [4]: [ws_item_sk#34, ws_bill_addr_sk#35, ws_ext_sales_price#36, ca_address_sk#39]

(53) ReusedExchange [Reuses operator id: 23]
Output [2]: [i_item_sk#40, i_item_id#41]

(54) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [ws_item_sk#34]
Right keys [1]: [i_item_sk#40]
Join condition: None

(55) Project [codegen id : 17]
Output [2]: [ws_ext_sales_price#36, i_item_id#41]
Input [4]: [ws_item_sk#34, ws_ext_sales_price#36, i_item_sk#40, i_item_id#41]

(56) HashAggregate [codegen id : 17]
Input [2]: [ws_ext_sales_price#36, i_item_id#41]
Keys [1]: [i_item_id#41]
Functions [1]: [partial_sum(UnscaledValue(ws_ext_sales_price#36))]
Aggregate Attributes [1]: [sum#42]
Results [2]: [i_item_id#41, sum#43]

(57) Exchange
Input [2]: [i_item_id#41, sum#43]
Arguments: hashpartitioning(i_item_id#41, 5), ENSURE_REQUIREMENTS, [id=#44]

(58) HashAggregate [codegen id : 18]
Input [2]: [i_item_id#41, sum#43]
Keys [1]: [i_item_id#41]
Functions [1]: [sum(UnscaledValue(ws_ext_sales_price#36))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_ext_sales_price#36))#45]
Results [2]: [i_item_id#41, MakeDecimal(sum(UnscaledValue(ws_ext_sales_price#36))#45,17,2) AS total_sales#46]

(59) Union

(60) HashAggregate [codegen id : 19]
Input [2]: [i_item_id#11, total_sales#20]
Keys [1]: [i_item_id#11]
Functions [1]: [partial_sum(total_sales#20)]
Aggregate Attributes [2]: [sum#47, isEmpty#48]
Results [3]: [i_item_id#11, sum#49, isEmpty#50]

(61) Exchange
Input [3]: [i_item_id#11, sum#49, isEmpty#50]
Arguments: hashpartitioning(i_item_id#11, 5), ENSURE_REQUIREMENTS, [id=#51]

(62) HashAggregate [codegen id : 20]
Input [3]: [i_item_id#11, sum#49, isEmpty#50]
Keys [1]: [i_item_id#11]
Functions [1]: [sum(total_sales#20)]
Aggregate Attributes [1]: [sum(total_sales#20)#52]
Results [2]: [i_item_id#11, sum(total_sales#20)#52 AS total_sales#53]

(63) TakeOrderedAndProject
Input [2]: [i_item_id#11, total_sales#53]
Arguments: 100, [total_sales#53 ASC NULLS FIRST], [i_item_id#11, total_sales#53]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#4 IN dynamicpruning#5
BroadcastExchange (68)
+- * Project (67)
   +- * Filter (66)
      +- * ColumnarToRow (65)
         +- Scan parquet default.date_dim (64)


(64) Scan parquet default.date_dim
Output [3]: [d_date_sk#6, d_year#54, d_moy#55]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), IsNotNull(d_moy), EqualTo(d_year,2001), EqualTo(d_moy,2), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_moy:int>

(65) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#6, d_year#54, d_moy#55]

(66) Filter [codegen id : 1]
Input [3]: [d_date_sk#6, d_year#54, d_moy#55]
Condition : ((((isnotnull(d_year#54) AND isnotnull(d_moy#55)) AND (d_year#54 = 2001)) AND (d_moy#55 = 2)) AND isnotnull(d_date_sk#6))

(67) Project [codegen id : 1]
Output [1]: [d_date_sk#6]
Input [3]: [d_date_sk#6, d_year#54, d_moy#55]

(68) BroadcastExchange
Input [1]: [d_date_sk#6]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#56]

Subquery:2 Hosting operator id = 29 Hosting Expression = cs_sold_date_sk#24 IN dynamicpruning#5

Subquery:3 Hosting operator id = 44 Hosting Expression = ws_sold_date_sk#37 IN dynamicpruning#5


