== Physical Plan ==
TakeOrderedAndProject (48)
+- * HashAggregate (47)
   +- Exchange (46)
      +- * HashAggregate (45)
         +- * Project (44)
            +- * BroadcastHashJoin Inner BuildRight (43)
               :- * Project (38)
               :  +- * BroadcastHashJoin Inner BuildRight (37)
               :     :- * Project (32)
               :     :  +- * BroadcastHashJoin Inner BuildRight (31)
               :     :     :- * Project (29)
               :     :     :  +- * BroadcastHashJoin Inner BuildRight (28)
               :     :     :     :- * Project (22)
               :     :     :     :  +- * BroadcastHashJoin Inner BuildRight (21)
               :     :     :     :     :- * Project (15)
               :     :     :     :     :  +- * BroadcastHashJoin Inner BuildRight (14)
               :     :     :     :     :     :- * Project (9)
               :     :     :     :     :     :  +- * BroadcastHashJoin Inner BuildRight (8)
               :     :     :     :     :     :     :- * Filter (3)
               :     :     :     :     :     :     :  +- * ColumnarToRow (2)
               :     :     :     :     :     :     :     +- Scan parquet spark_catalog.default.store_sales (1)
               :     :     :     :     :     :     +- BroadcastExchange (7)
               :     :     :     :     :     :        +- * Filter (6)
               :     :     :     :     :     :           +- * ColumnarToRow (5)
               :     :     :     :     :     :              +- Scan parquet spark_catalog.default.store_returns (4)
               :     :     :     :     :     +- BroadcastExchange (13)
               :     :     :     :     :        +- * Filter (12)
               :     :     :     :     :           +- * ColumnarToRow (11)
               :     :     :     :     :              +- Scan parquet spark_catalog.default.catalog_sales (10)
               :     :     :     :     +- BroadcastExchange (20)
               :     :     :     :        +- * Project (19)
               :     :     :     :           +- * Filter (18)
               :     :     :     :              +- * ColumnarToRow (17)
               :     :     :     :                 +- Scan parquet spark_catalog.default.date_dim (16)
               :     :     :     +- BroadcastExchange (27)
               :     :     :        +- * Project (26)
               :     :     :           +- * Filter (25)
               :     :     :              +- * ColumnarToRow (24)
               :     :     :                 +- Scan parquet spark_catalog.default.date_dim (23)
               :     :     +- ReusedExchange (30)
               :     +- BroadcastExchange (36)
               :        +- * Filter (35)
               :           +- * ColumnarToRow (34)
               :              +- Scan parquet spark_catalog.default.store (33)
               +- BroadcastExchange (42)
                  +- * Filter (41)
                     +- * ColumnarToRow (40)
                        +- Scan parquet spark_catalog.default.item (39)


(1) Scan parquet spark_catalog.default.store_sales
Output [6]: [ss_item_sk#1, ss_customer_sk#2, ss_store_sk#3, ss_ticket_number#4, ss_quantity#5, ss_sold_date_sk#6]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#6)]
PushedFilters: [IsNotNull(ss_customer_sk), IsNotNull(ss_item_sk), IsNotNull(ss_ticket_number), IsNotNull(ss_store_sk)]
ReadSchema: struct<ss_item_sk:int,ss_customer_sk:int,ss_store_sk:int,ss_ticket_number:int,ss_quantity:int>

(2) ColumnarToRow [codegen id : 8]
Input [6]: [ss_item_sk#1, ss_customer_sk#2, ss_store_sk#3, ss_ticket_number#4, ss_quantity#5, ss_sold_date_sk#6]

(3) Filter [codegen id : 8]
Input [6]: [ss_item_sk#1, ss_customer_sk#2, ss_store_sk#3, ss_ticket_number#4, ss_quantity#5, ss_sold_date_sk#6]
Condition : (((isnotnull(ss_customer_sk#2) AND isnotnull(ss_item_sk#1)) AND isnotnull(ss_ticket_number#4)) AND isnotnull(ss_store_sk#3))

(4) Scan parquet spark_catalog.default.store_returns
Output [5]: [sr_item_sk#7, sr_customer_sk#8, sr_ticket_number#9, sr_return_quantity#10, sr_returned_date_sk#11]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(sr_returned_date_sk#11)]
PushedFilters: [IsNotNull(sr_customer_sk), IsNotNull(sr_item_sk), IsNotNull(sr_ticket_number)]
ReadSchema: struct<sr_item_sk:int,sr_customer_sk:int,sr_ticket_number:int,sr_return_quantity:int>

(5) ColumnarToRow [codegen id : 1]
Input [5]: [sr_item_sk#7, sr_customer_sk#8, sr_ticket_number#9, sr_return_quantity#10, sr_returned_date_sk#11]

(6) Filter [codegen id : 1]
Input [5]: [sr_item_sk#7, sr_customer_sk#8, sr_ticket_number#9, sr_return_quantity#10, sr_returned_date_sk#11]
Condition : ((isnotnull(sr_customer_sk#8) AND isnotnull(sr_item_sk#7)) AND isnotnull(sr_ticket_number#9))

(7) BroadcastExchange
Input [5]: [sr_item_sk#7, sr_customer_sk#8, sr_ticket_number#9, sr_return_quantity#10, sr_returned_date_sk#11]
Arguments: HashedRelationBroadcastMode(List(input[1, int, false], input[0, int, false], input[2, int, false]),false), [plan_id=1]

(8) BroadcastHashJoin [codegen id : 8]
Left keys [3]: [ss_customer_sk#2, ss_item_sk#1, ss_ticket_number#4]
Right keys [3]: [sr_customer_sk#8, sr_item_sk#7, sr_ticket_number#9]
Join type: Inner
Join condition: None

(9) Project [codegen id : 8]
Output [8]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, ss_sold_date_sk#6, sr_item_sk#7, sr_customer_sk#8, sr_return_quantity#10, sr_returned_date_sk#11]
Input [11]: [ss_item_sk#1, ss_customer_sk#2, ss_store_sk#3, ss_ticket_number#4, ss_quantity#5, ss_sold_date_sk#6, sr_item_sk#7, sr_customer_sk#8, sr_ticket_number#9, sr_return_quantity#10, sr_returned_date_sk#11]

(10) Scan parquet spark_catalog.default.catalog_sales
Output [4]: [cs_bill_customer_sk#12, cs_item_sk#13, cs_quantity#14, cs_sold_date_sk#15]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#15)]
PushedFilters: [IsNotNull(cs_bill_customer_sk), IsNotNull(cs_item_sk)]
ReadSchema: struct<cs_bill_customer_sk:int,cs_item_sk:int,cs_quantity:int>

(11) ColumnarToRow [codegen id : 2]
Input [4]: [cs_bill_customer_sk#12, cs_item_sk#13, cs_quantity#14, cs_sold_date_sk#15]

(12) Filter [codegen id : 2]
Input [4]: [cs_bill_customer_sk#12, cs_item_sk#13, cs_quantity#14, cs_sold_date_sk#15]
Condition : (isnotnull(cs_bill_customer_sk#12) AND isnotnull(cs_item_sk#13))

(13) BroadcastExchange
Input [4]: [cs_bill_customer_sk#12, cs_item_sk#13, cs_quantity#14, cs_sold_date_sk#15]
Arguments: HashedRelationBroadcastMode(List((shiftleft(cast(input[0, int, false] as bigint), 32) | (cast(input[1, int, false] as bigint) & 4294967295))),false), [plan_id=2]

(14) BroadcastHashJoin [codegen id : 8]
Left keys [2]: [sr_customer_sk#8, sr_item_sk#7]
Right keys [2]: [cs_bill_customer_sk#12, cs_item_sk#13]
Join type: Inner
Join condition: None

(15) Project [codegen id : 8]
Output [8]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, ss_sold_date_sk#6, sr_return_quantity#10, sr_returned_date_sk#11, cs_quantity#14, cs_sold_date_sk#15]
Input [12]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, ss_sold_date_sk#6, sr_item_sk#7, sr_customer_sk#8, sr_return_quantity#10, sr_returned_date_sk#11, cs_bill_customer_sk#12, cs_item_sk#13, cs_quantity#14, cs_sold_date_sk#15]

(16) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#16, d_quarter_name#17]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_quarter_name), EqualTo(d_quarter_name,2001Q1), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_quarter_name:string>

(17) ColumnarToRow [codegen id : 3]
Input [2]: [d_date_sk#16, d_quarter_name#17]

(18) Filter [codegen id : 3]
Input [2]: [d_date_sk#16, d_quarter_name#17]
Condition : ((isnotnull(d_quarter_name#17) AND (d_quarter_name#17 = 2001Q1)) AND isnotnull(d_date_sk#16))

(19) Project [codegen id : 3]
Output [1]: [d_date_sk#16]
Input [2]: [d_date_sk#16, d_quarter_name#17]

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

(21) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_sold_date_sk#6]
Right keys [1]: [d_date_sk#16]
Join type: Inner
Join condition: None

(22) Project [codegen id : 8]
Output [7]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, sr_return_quantity#10, sr_returned_date_sk#11, cs_quantity#14, cs_sold_date_sk#15]
Input [9]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, ss_sold_date_sk#6, sr_return_quantity#10, sr_returned_date_sk#11, cs_quantity#14, cs_sold_date_sk#15, d_date_sk#16]

(23) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#18, d_quarter_name#19]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [In(d_quarter_name, [2001Q1,2001Q2,2001Q3]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_quarter_name:string>

(24) ColumnarToRow [codegen id : 4]
Input [2]: [d_date_sk#18, d_quarter_name#19]

(25) Filter [codegen id : 4]
Input [2]: [d_date_sk#18, d_quarter_name#19]
Condition : (d_quarter_name#19 IN (2001Q1,2001Q2,2001Q3) AND isnotnull(d_date_sk#18))

(26) Project [codegen id : 4]
Output [1]: [d_date_sk#18]
Input [2]: [d_date_sk#18, d_quarter_name#19]

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

(28) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [sr_returned_date_sk#11]
Right keys [1]: [d_date_sk#18]
Join type: Inner
Join condition: None

(29) Project [codegen id : 8]
Output [6]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, sr_return_quantity#10, cs_quantity#14, cs_sold_date_sk#15]
Input [8]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, sr_return_quantity#10, sr_returned_date_sk#11, cs_quantity#14, cs_sold_date_sk#15, d_date_sk#18]

(30) ReusedExchange [Reuses operator id: 27]
Output [1]: [d_date_sk#20]

(31) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [cs_sold_date_sk#15]
Right keys [1]: [d_date_sk#20]
Join type: Inner
Join condition: None

(32) Project [codegen id : 8]
Output [5]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, sr_return_quantity#10, cs_quantity#14]
Input [7]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, sr_return_quantity#10, cs_quantity#14, cs_sold_date_sk#15, d_date_sk#20]

(33) Scan parquet spark_catalog.default.store
Output [2]: [s_store_sk#21, s_state#22]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store]
PushedFilters: [IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_state:string>

(34) ColumnarToRow [codegen id : 6]
Input [2]: [s_store_sk#21, s_state#22]

(35) Filter [codegen id : 6]
Input [2]: [s_store_sk#21, s_state#22]
Condition : isnotnull(s_store_sk#21)

(36) BroadcastExchange
Input [2]: [s_store_sk#21, s_state#22]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=5]

(37) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_store_sk#3]
Right keys [1]: [s_store_sk#21]
Join type: Inner
Join condition: None

(38) Project [codegen id : 8]
Output [5]: [ss_item_sk#1, ss_quantity#5, sr_return_quantity#10, cs_quantity#14, s_state#22]
Input [7]: [ss_item_sk#1, ss_store_sk#3, ss_quantity#5, sr_return_quantity#10, cs_quantity#14, s_store_sk#21, s_state#22]

(39) Scan parquet spark_catalog.default.item
Output [3]: [i_item_sk#23, i_item_id#24, i_item_desc#25]
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,i_item_desc:string>

(40) ColumnarToRow [codegen id : 7]
Input [3]: [i_item_sk#23, i_item_id#24, i_item_desc#25]

(41) Filter [codegen id : 7]
Input [3]: [i_item_sk#23, i_item_id#24, i_item_desc#25]
Condition : isnotnull(i_item_sk#23)

(42) BroadcastExchange
Input [3]: [i_item_sk#23, i_item_id#24, i_item_desc#25]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=6]

(43) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#23]
Join type: Inner
Join condition: None

(44) Project [codegen id : 8]
Output [6]: [ss_quantity#5, sr_return_quantity#10, cs_quantity#14, s_state#22, i_item_id#24, i_item_desc#25]
Input [8]: [ss_item_sk#1, ss_quantity#5, sr_return_quantity#10, cs_quantity#14, s_state#22, i_item_sk#23, i_item_id#24, i_item_desc#25]

(45) HashAggregate [codegen id : 8]
Input [6]: [ss_quantity#5, sr_return_quantity#10, cs_quantity#14, s_state#22, i_item_id#24, i_item_desc#25]
Keys [3]: [i_item_id#24, i_item_desc#25, s_state#22]
Functions [9]: [partial_count(ss_quantity#5), partial_avg(ss_quantity#5), partial_stddev_samp(cast(ss_quantity#5 as double)), partial_count(sr_return_quantity#10), partial_avg(sr_return_quantity#10), partial_stddev_samp(cast(sr_return_quantity#10 as double)), partial_count(cs_quantity#14), partial_avg(cs_quantity#14), partial_stddev_samp(cast(cs_quantity#14 as double))]
Aggregate Attributes [18]: [count#26, sum#27, count#28, n#29, avg#30, m2#31, count#32, sum#33, count#34, n#35, avg#36, m2#37, count#38, sum#39, count#40, n#41, avg#42, m2#43]
Results [21]: [i_item_id#24, i_item_desc#25, s_state#22, count#44, sum#45, count#46, n#47, avg#48, m2#49, count#50, sum#51, count#52, n#53, avg#54, m2#55, count#56, sum#57, count#58, n#59, avg#60, m2#61]

(46) Exchange
Input [21]: [i_item_id#24, i_item_desc#25, s_state#22, count#44, sum#45, count#46, n#47, avg#48, m2#49, count#50, sum#51, count#52, n#53, avg#54, m2#55, count#56, sum#57, count#58, n#59, avg#60, m2#61]
Arguments: hashpartitioning(i_item_id#24, i_item_desc#25, s_state#22, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(47) HashAggregate [codegen id : 9]
Input [21]: [i_item_id#24, i_item_desc#25, s_state#22, count#44, sum#45, count#46, n#47, avg#48, m2#49, count#50, sum#51, count#52, n#53, avg#54, m2#55, count#56, sum#57, count#58, n#59, avg#60, m2#61]
Keys [3]: [i_item_id#24, i_item_desc#25, s_state#22]
Functions [9]: [count(ss_quantity#5), avg(ss_quantity#5), stddev_samp(cast(ss_quantity#5 as double)), count(sr_return_quantity#10), avg(sr_return_quantity#10), stddev_samp(cast(sr_return_quantity#10 as double)), count(cs_quantity#14), avg(cs_quantity#14), stddev_samp(cast(cs_quantity#14 as double))]
Aggregate Attributes [9]: [count(ss_quantity#5)#62, avg(ss_quantity#5)#63, stddev_samp(cast(ss_quantity#5 as double))#64, count(sr_return_quantity#10)#65, avg(sr_return_quantity#10)#66, stddev_samp(cast(sr_return_quantity#10 as double))#67, count(cs_quantity#14)#68, avg(cs_quantity#14)#69, stddev_samp(cast(cs_quantity#14 as double))#70]
Results [15]: [i_item_id#24, i_item_desc#25, s_state#22, count(ss_quantity#5)#62 AS store_sales_quantitycount#71, avg(ss_quantity#5)#63 AS store_sales_quantityave#72, stddev_samp(cast(ss_quantity#5 as double))#64 AS store_sales_quantitystdev#73, (stddev_samp(cast(ss_quantity#5 as double))#64 / avg(ss_quantity#5)#63) AS store_sales_quantitycov#74, count(sr_return_quantity#10)#65 AS as_store_returns_quantitycount#75, avg(sr_return_quantity#10)#66 AS as_store_returns_quantityave#76, stddev_samp(cast(sr_return_quantity#10 as double))#67 AS as_store_returns_quantitystdev#77, (stddev_samp(cast(sr_return_quantity#10 as double))#67 / avg(sr_return_quantity#10)#66) AS store_returns_quantitycov#78, count(cs_quantity#14)#68 AS catalog_sales_quantitycount#79, avg(cs_quantity#14)#69 AS catalog_sales_quantityave#80, (stddev_samp(cast(cs_quantity#14 as double))#70 / avg(cs_quantity#14)#69) AS catalog_sales_quantitystdev#81, (stddev_samp(cast(cs_quantity#14 as double))#70 / avg(cs_quantity#14)#69) AS catalog_sales_quantitycov#82]

(48) TakeOrderedAndProject
Input [15]: [i_item_id#24, i_item_desc#25, s_state#22, store_sales_quantitycount#71, store_sales_quantityave#72, store_sales_quantitystdev#73, store_sales_quantitycov#74, as_store_returns_quantitycount#75, as_store_returns_quantityave#76, as_store_returns_quantitystdev#77, store_returns_quantitycov#78, catalog_sales_quantitycount#79, catalog_sales_quantityave#80, catalog_sales_quantitystdev#81, catalog_sales_quantitycov#82]
Arguments: 100, [i_item_id#24 ASC NULLS FIRST, i_item_desc#25 ASC NULLS FIRST, s_state#22 ASC NULLS FIRST], [i_item_id#24, i_item_desc#25, s_state#22, store_sales_quantitycount#71, store_sales_quantityave#72, store_sales_quantitystdev#73, store_sales_quantitycov#74, as_store_returns_quantitycount#75, as_store_returns_quantityave#76, as_store_returns_quantitystdev#77, store_returns_quantitycov#78, catalog_sales_quantitycount#79, catalog_sales_quantityave#80, catalog_sales_quantitystdev#81, catalog_sales_quantitycov#82]

