== Physical Plan ==
TakeOrderedAndProject (62)
+- * HashAggregate (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 spark_catalog.default.store_sales (1)
         :              :     :     +- ReusedExchange (4)
         :              :     +- BroadcastExchange (11)
         :              :        +- * Project (10)
         :              :           +- * Filter (9)
         :              :              +- * ColumnarToRow (8)
         :              :                 +- Scan parquet spark_catalog.default.customer_address (7)
         :              +- BroadcastExchange (23)
         :                 +- * BroadcastHashJoin LeftSemi BuildRight (22)
         :                    :- * Filter (16)
         :                    :  +- * ColumnarToRow (15)
         :                    :     +- Scan parquet spark_catalog.default.item (14)
         :                    +- BroadcastExchange (21)
         :                       +- * Project (20)
         :                          +- * Filter (19)
         :                             +- * ColumnarToRow (18)
         :                                +- Scan parquet spark_catalog.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 spark_catalog.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 spark_catalog.default.web_sales (44)
                        :     :     +- ReusedExchange (47)
                        :     +- ReusedExchange (50)
                        +- ReusedExchange (53)


(1) Scan parquet spark_catalog.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: 67]
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 type: Inner
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 spark_catalog.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), [plan_id=1]

(12) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_addr_sk#2]
Right keys [1]: [ca_address_sk#7]
Join type: Inner
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 spark_catalog.default.item
Output [2]: [i_item_sk#9, i_item_id#10]
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#9, i_item_id#10]

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

(17) Scan parquet spark_catalog.default.item
Output [2]: [i_item_id#11, i_color#12]
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#11, i_color#12]

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

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

(21) BroadcastExchange
Input [1]: [i_item_id#11]
Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [plan_id=2]

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

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

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

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

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

(27) Exchange
Input [2]: [i_item_id#10, sum#14]
Arguments: hashpartitioning(i_item_id#10, 5), ENSURE_REQUIREMENTS, [plan_id=4]

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

(29) Scan parquet spark_catalog.default.catalog_sales
Output [4]: [cs_bill_addr_sk#17, cs_item_sk#18, cs_ext_sales_price#19, cs_sold_date_sk#20]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#20), dynamicpruningexpression(cs_sold_date_sk#20 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#17, cs_item_sk#18, cs_ext_sales_price#19, cs_sold_date_sk#20]

(31) Filter [codegen id : 11]
Input [4]: [cs_bill_addr_sk#17, cs_item_sk#18, cs_ext_sales_price#19, cs_sold_date_sk#20]
Condition : (isnotnull(cs_bill_addr_sk#17) AND isnotnull(cs_item_sk#18))

(32) ReusedExchange [Reuses operator id: 67]
Output [1]: [d_date_sk#21]

(33) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_sold_date_sk#20]
Right keys [1]: [d_date_sk#21]
Join type: Inner
Join condition: None

(34) Project [codegen id : 11]
Output [3]: [cs_bill_addr_sk#17, cs_item_sk#18, cs_ext_sales_price#19]
Input [5]: [cs_bill_addr_sk#17, cs_item_sk#18, cs_ext_sales_price#19, cs_sold_date_sk#20, d_date_sk#21]

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

(36) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_bill_addr_sk#17]
Right keys [1]: [ca_address_sk#22]
Join type: Inner
Join condition: None

(37) Project [codegen id : 11]
Output [2]: [cs_item_sk#18, cs_ext_sales_price#19]
Input [4]: [cs_bill_addr_sk#17, cs_item_sk#18, cs_ext_sales_price#19, ca_address_sk#22]

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

(39) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_item_sk#18]
Right keys [1]: [i_item_sk#23]
Join type: Inner
Join condition: None

(40) Project [codegen id : 11]
Output [2]: [cs_ext_sales_price#19, i_item_id#24]
Input [4]: [cs_item_sk#18, cs_ext_sales_price#19, i_item_sk#23, i_item_id#24]

(41) HashAggregate [codegen id : 11]
Input [2]: [cs_ext_sales_price#19, i_item_id#24]
Keys [1]: [i_item_id#24]
Functions [1]: [partial_sum(UnscaledValue(cs_ext_sales_price#19))]
Aggregate Attributes [1]: [sum#25]
Results [2]: [i_item_id#24, sum#26]

(42) Exchange
Input [2]: [i_item_id#24, sum#26]
Arguments: hashpartitioning(i_item_id#24, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(43) HashAggregate [codegen id : 12]
Input [2]: [i_item_id#24, sum#26]
Keys [1]: [i_item_id#24]
Functions [1]: [sum(UnscaledValue(cs_ext_sales_price#19))]
Aggregate Attributes [1]: [sum(UnscaledValue(cs_ext_sales_price#19))#27]
Results [2]: [i_item_id#24, MakeDecimal(sum(UnscaledValue(cs_ext_sales_price#19))#27,17,2) AS total_sales#28]

(44) Scan parquet spark_catalog.default.web_sales
Output [4]: [ws_item_sk#29, ws_bill_addr_sk#30, ws_ext_sales_price#31, ws_sold_date_sk#32]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#32), dynamicpruningexpression(ws_sold_date_sk#32 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#29, ws_bill_addr_sk#30, ws_ext_sales_price#31, ws_sold_date_sk#32]

(46) Filter [codegen id : 17]
Input [4]: [ws_item_sk#29, ws_bill_addr_sk#30, ws_ext_sales_price#31, ws_sold_date_sk#32]
Condition : (isnotnull(ws_bill_addr_sk#30) AND isnotnull(ws_item_sk#29))

(47) ReusedExchange [Reuses operator id: 67]
Output [1]: [d_date_sk#33]

(48) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [ws_sold_date_sk#32]
Right keys [1]: [d_date_sk#33]
Join type: Inner
Join condition: None

(49) Project [codegen id : 17]
Output [3]: [ws_item_sk#29, ws_bill_addr_sk#30, ws_ext_sales_price#31]
Input [5]: [ws_item_sk#29, ws_bill_addr_sk#30, ws_ext_sales_price#31, ws_sold_date_sk#32, d_date_sk#33]

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

(51) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [ws_bill_addr_sk#30]
Right keys [1]: [ca_address_sk#34]
Join type: Inner
Join condition: None

(52) Project [codegen id : 17]
Output [2]: [ws_item_sk#29, ws_ext_sales_price#31]
Input [4]: [ws_item_sk#29, ws_bill_addr_sk#30, ws_ext_sales_price#31, ca_address_sk#34]

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

(54) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [ws_item_sk#29]
Right keys [1]: [i_item_sk#35]
Join type: Inner
Join condition: None

(55) Project [codegen id : 17]
Output [2]: [ws_ext_sales_price#31, i_item_id#36]
Input [4]: [ws_item_sk#29, ws_ext_sales_price#31, i_item_sk#35, i_item_id#36]

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

(57) Exchange
Input [2]: [i_item_id#36, sum#38]
Arguments: hashpartitioning(i_item_id#36, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(58) HashAggregate [codegen id : 18]
Input [2]: [i_item_id#36, sum#38]
Keys [1]: [i_item_id#36]
Functions [1]: [sum(UnscaledValue(ws_ext_sales_price#31))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_ext_sales_price#31))#39]
Results [2]: [i_item_id#36, MakeDecimal(sum(UnscaledValue(ws_ext_sales_price#31))#39,17,2) AS total_sales#40]

(59) Union

(60) HashAggregate [codegen id : 19]
Input [2]: [i_item_id#10, total_sales#16]
Keys [1]: [i_item_id#10]
Functions [1]: [partial_sum(total_sales#16)]
Aggregate Attributes [2]: [sum#41, isEmpty#42]
Results [3]: [i_item_id#10, sum#43, isEmpty#44]

(61) HashAggregate [codegen id : 19]
Input [3]: [i_item_id#10, sum#43, isEmpty#44]
Keys [1]: [i_item_id#10]
Functions [1]: [sum(total_sales#16)]
Aggregate Attributes [1]: [sum(total_sales#16)#45]
Results [2]: [i_item_id#10, sum(total_sales#16)#45 AS total_sales#46]

(62) TakeOrderedAndProject
Input [2]: [i_item_id#10, total_sales#46]
Arguments: 100, [total_sales#46 ASC NULLS FIRST], [i_item_id#10, total_sales#46]

===== Subqueries =====

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


(63) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#6, d_year#47, d_moy#48]
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>

(64) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#6, d_year#47, d_moy#48]

(65) Filter [codegen id : 1]
Input [3]: [d_date_sk#6, d_year#47, d_moy#48]
Condition : ((((isnotnull(d_year#47) AND isnotnull(d_moy#48)) AND (d_year#47 = 2001)) AND (d_moy#48 = 2)) AND isnotnull(d_date_sk#6))

(66) Project [codegen id : 1]
Output [1]: [d_date_sk#6]
Input [3]: [d_date_sk#6, d_year#47, d_moy#48]

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

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

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


