TakeOrderedAndProject [channel,i_brand_id,i_class_id,i_category_id,sum_sales,number_sales]
  WholeStageCodegen (401)
    HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum_sales,number_sales]
      InputAdapter
        Exchange [channel,i_brand_id,i_class_id,i_category_id,sum_sales,number_sales] #1
          WholeStageCodegen (400)
            HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum_sales,number_sales]
              InputAdapter
                Union
                  WholeStageCodegen (79)
                    HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum,isEmpty,sum] [sum(sales),sum(number_salesL),sum_sales,number_sales,sum,isEmpty,sum]
                      HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                        InputAdapter
                          Union
                            WholeStageCodegen (26)
                              Filter [sales]
                                Subquery #3
                                  WholeStageCodegen (8)
                                    HashAggregate [sum,count] [avg((cast(quantity as decimal(10,0)) * list_price)),average_sales,sum,count]
                                      InputAdapter
                                        Exchange #13
                                          WholeStageCodegen (7)
                                            HashAggregate [quantity,list_price] [sum,count,sum,count]
                                              InputAdapter
                                                Union
                                                  WholeStageCodegen (2)
                                                    Project [ss_quantity,ss_list_price]
                                                      BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                        ColumnarToRow
                                                          InputAdapter
                                                            Scan parquet spark_catalog.default.store_sales [ss_quantity,ss_list_price,ss_sold_date_sk]
                                                              ReusedSubquery [d_date_sk] #2
                                                        InputAdapter
                                                          ReusedExchange [d_date_sk] #7
                                                  WholeStageCodegen (4)
                                                    Project [cs_quantity,cs_list_price]
                                                      BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                        ColumnarToRow
                                                          InputAdapter
                                                            Scan parquet spark_catalog.default.catalog_sales [cs_quantity,cs_list_price,cs_sold_date_sk]
                                                              SubqueryBroadcast [d_date_sk] #4
                                                                BroadcastExchange #14
                                                                  WholeStageCodegen (1)
                                                                    Project [d_date_sk]
                                                                      Filter [d_year,d_date_sk]
                                                                        ColumnarToRow
                                                                          InputAdapter
                                                                            Scan parquet spark_catalog.default.date_dim [d_date_sk,d_year]
                                                        InputAdapter
                                                          ReusedExchange [d_date_sk] #14
                                                  WholeStageCodegen (6)
                                                    Project [ws_quantity,ws_list_price]
                                                      BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                        ColumnarToRow
                                                          InputAdapter
                                                            Scan parquet spark_catalog.default.web_sales [ws_quantity,ws_list_price,ws_sold_date_sk]
                                                              ReusedSubquery [d_date_sk] #4
                                                        InputAdapter
                                                          ReusedExchange [d_date_sk] #14
                                HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ss_quantity as decimal(10,0)) * ss_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                  InputAdapter
                                    Exchange [i_brand_id,i_class_id,i_category_id] #2
                                      WholeStageCodegen (25)
                                        HashAggregate [i_brand_id,i_class_id,i_category_id,ss_quantity,ss_list_price] [sum,isEmpty,count,sum,isEmpty,count]
                                          Project [ss_quantity,ss_list_price,i_brand_id,i_class_id,i_category_id]
                                            BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                              Project [ss_quantity,ss_list_price,ss_sold_date_sk,i_brand_id,i_class_id,i_category_id]
                                                BroadcastHashJoin [ss_item_sk,i_item_sk]
                                                  BroadcastHashJoin [ss_item_sk,ss_item_sk]
                                                    Filter [ss_item_sk]
                                                      ColumnarToRow
                                                        InputAdapter
                                                          Scan parquet spark_catalog.default.store_sales [ss_item_sk,ss_quantity,ss_list_price,ss_sold_date_sk]
                                                            SubqueryBroadcast [d_date_sk] #1
                                                              BroadcastExchange #3
                                                                WholeStageCodegen (1)
                                                                  Project [d_date_sk]
                                                                    Filter [d_year,d_moy,d_date_sk]
                                                                      ColumnarToRow
                                                                        InputAdapter
                                                                          Scan parquet spark_catalog.default.date_dim [d_date_sk,d_year,d_moy]
                                                    InputAdapter
                                                      BroadcastExchange #4
                                                        WholeStageCodegen (11)
                                                          Project [i_item_sk]
                                                            BroadcastHashJoin [i_brand_id,i_class_id,i_category_id,brand_id,class_id,category_id]
                                                              Filter [i_brand_id,i_class_id,i_category_id]
                                                                ColumnarToRow
                                                                  InputAdapter
                                                                    Scan parquet spark_catalog.default.item [i_item_sk,i_brand_id,i_class_id,i_category_id]
                                                              InputAdapter
                                                                BroadcastExchange #5
                                                                  WholeStageCodegen (10)
                                                                    BroadcastHashJoin [brand_id,class_id,category_id,i_brand_id,i_class_id,i_category_id]
                                                                      HashAggregate [brand_id,class_id,category_id]
                                                                        InputAdapter
                                                                          Exchange [brand_id,class_id,category_id] #6
                                                                            WholeStageCodegen (6)
                                                                              HashAggregate [brand_id,class_id,category_id]
                                                                                Project [i_brand_id,i_class_id,i_category_id]
                                                                                  BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                                    Project [ss_sold_date_sk,i_brand_id,i_class_id,i_category_id]
                                                                                      BroadcastHashJoin [ss_item_sk,i_item_sk]
                                                                                        Filter [ss_item_sk]
                                                                                          ColumnarToRow
                                                                                            InputAdapter
                                                                                              Scan parquet spark_catalog.default.store_sales [ss_item_sk,ss_sold_date_sk]
                                                                                                SubqueryBroadcast [d_date_sk] #2
                                                                                                  BroadcastExchange #7
                                                                                                    WholeStageCodegen (1)
                                                                                                      Project [d_date_sk]
                                                                                                        Filter [d_year,d_date_sk]
                                                                                                          ColumnarToRow
                                                                                                            InputAdapter
                                                                                                              Scan parquet spark_catalog.default.date_dim [d_date_sk,d_year]
                                                                                        InputAdapter
                                                                                          BroadcastExchange #8
                                                                                            WholeStageCodegen (4)
                                                                                              BroadcastHashJoin [i_brand_id,i_class_id,i_category_id,i_brand_id,i_class_id,i_category_id]
                                                                                                Filter [i_item_sk,i_brand_id,i_class_id,i_category_id]
                                                                                                  ColumnarToRow
                                                                                                    InputAdapter
                                                                                                      Scan parquet spark_catalog.default.item [i_item_sk,i_brand_id,i_class_id,i_category_id]
                                                                                                InputAdapter
                                                                                                  BroadcastExchange #9
                                                                                                    WholeStageCodegen (3)
                                                                                                      Project [i_brand_id,i_class_id,i_category_id]
                                                                                                        BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                                                                          Project [cs_sold_date_sk,i_brand_id,i_class_id,i_category_id]
                                                                                                            BroadcastHashJoin [cs_item_sk,i_item_sk]
                                                                                                              Filter [cs_item_sk]
                                                                                                                ColumnarToRow
                                                                                                                  InputAdapter
                                                                                                                    Scan parquet spark_catalog.default.catalog_sales [cs_item_sk,cs_sold_date_sk]
                                                                                                                      ReusedSubquery [d_date_sk] #2
                                                                                                              InputAdapter
                                                                                                                BroadcastExchange #10
                                                                                                                  WholeStageCodegen (1)
                                                                                                                    Filter [i_item_sk]
                                                                                                                      ColumnarToRow
                                                                                                                        InputAdapter
                                                                                                                          Scan parquet spark_catalog.default.item [i_item_sk,i_brand_id,i_class_id,i_category_id]
                                                                                                          InputAdapter
                                                                                                            ReusedExchange [d_date_sk] #7
                                                                                    InputAdapter
                                                                                      ReusedExchange [d_date_sk] #7
                                                                      InputAdapter
                                                                        BroadcastExchange #11
                                                                          WholeStageCodegen (9)
                                                                            Project [i_brand_id,i_class_id,i_category_id]
                                                                              BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                                                Project [ws_sold_date_sk,i_brand_id,i_class_id,i_category_id]
                                                                                  BroadcastHashJoin [ws_item_sk,i_item_sk]
                                                                                    Filter [ws_item_sk]
                                                                                      ColumnarToRow
                                                                                        InputAdapter
                                                                                          Scan parquet spark_catalog.default.web_sales [ws_item_sk,ws_sold_date_sk]
                                                                                            ReusedSubquery [d_date_sk] #2
                                                                                    InputAdapter
                                                                                      ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id] #10
                                                                                InputAdapter
                                                                                  ReusedExchange [d_date_sk] #7
                                                  InputAdapter
                                                    BroadcastExchange #12
                                                      WholeStageCodegen (23)
                                                        BroadcastHashJoin [i_item_sk,ss_item_sk]
                                                          Filter [i_item_sk]
                                                            ColumnarToRow
                                                              InputAdapter
                                                                Scan parquet spark_catalog.default.item [i_item_sk,i_brand_id,i_class_id,i_category_id]
                                                          InputAdapter
                                                            ReusedExchange [ss_item_sk] #4
                                              InputAdapter
                                                ReusedExchange [d_date_sk] #3
                            WholeStageCodegen (52)
                              Filter [sales]
                                ReusedSubquery [average_sales] #3
                                HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(cs_quantity as decimal(10,0)) * cs_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                  InputAdapter
                                    Exchange [i_brand_id,i_class_id,i_category_id] #15
                                      WholeStageCodegen (51)
                                        HashAggregate [i_brand_id,i_class_id,i_category_id,cs_quantity,cs_list_price] [sum,isEmpty,count,sum,isEmpty,count]
                                          Project [cs_quantity,cs_list_price,i_brand_id,i_class_id,i_category_id]
                                            BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                              Project [cs_quantity,cs_list_price,cs_sold_date_sk,i_brand_id,i_class_id,i_category_id]
                                                BroadcastHashJoin [cs_item_sk,i_item_sk]
                                                  BroadcastHashJoin [cs_item_sk,ss_item_sk]
                                                    Filter [cs_item_sk]
                                                      ColumnarToRow
                                                        InputAdapter
                                                          Scan parquet spark_catalog.default.catalog_sales [cs_item_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                                            ReusedSubquery [d_date_sk] #1
                                                    InputAdapter
                                                      ReusedExchange [ss_item_sk] #4
                                                  InputAdapter
                                                    ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id] #12
                                              InputAdapter
                                                ReusedExchange [d_date_sk] #3
                            WholeStageCodegen (78)
                              Filter [sales]
                                ReusedSubquery [average_sales] #3
                                HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ws_quantity as decimal(10,0)) * ws_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                  InputAdapter
                                    Exchange [i_brand_id,i_class_id,i_category_id] #16
                                      WholeStageCodegen (77)
                                        HashAggregate [i_brand_id,i_class_id,i_category_id,ws_quantity,ws_list_price] [sum,isEmpty,count,sum,isEmpty,count]
                                          Project [ws_quantity,ws_list_price,i_brand_id,i_class_id,i_category_id]
                                            BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                              Project [ws_quantity,ws_list_price,ws_sold_date_sk,i_brand_id,i_class_id,i_category_id]
                                                BroadcastHashJoin [ws_item_sk,i_item_sk]
                                                  BroadcastHashJoin [ws_item_sk,ss_item_sk]
                                                    Filter [ws_item_sk]
                                                      ColumnarToRow
                                                        InputAdapter
                                                          Scan parquet spark_catalog.default.web_sales [ws_item_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                                            ReusedSubquery [d_date_sk] #1
                                                    InputAdapter
                                                      ReusedExchange [ss_item_sk] #4
                                                  InputAdapter
                                                    ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id] #12
                                              InputAdapter
                                                ReusedExchange [d_date_sk] #3
                  WholeStageCodegen (159)
                    HashAggregate [channel,i_brand_id,i_class_id,sum,isEmpty,sum] [sum(sum_sales),sum(number_salesL),i_category_id,sum(sum_sales),sum(number_sales),sum,isEmpty,sum]
                      InputAdapter
                        Exchange [channel,i_brand_id,i_class_id] #17
                          WholeStageCodegen (158)
                            HashAggregate [channel,i_brand_id,i_class_id,sum_sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                              HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum,isEmpty,sum] [sum(sales),sum(number_salesL),sum_sales,number_sales,sum,isEmpty,sum]
                                HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                                  InputAdapter
                                    Union
                                      WholeStageCodegen (105)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ss_quantity as decimal(10,0)) * ss_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #2
                                      WholeStageCodegen (131)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(cs_quantity as decimal(10,0)) * cs_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #15
                                      WholeStageCodegen (157)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ws_quantity as decimal(10,0)) * ws_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #16
                  WholeStageCodegen (239)
                    HashAggregate [channel,i_brand_id,sum,isEmpty,sum] [sum(sum_sales),sum(number_salesL),i_class_id,i_category_id,sum(sum_sales),sum(number_sales),sum,isEmpty,sum]
                      InputAdapter
                        Exchange [channel,i_brand_id] #18
                          WholeStageCodegen (238)
                            HashAggregate [channel,i_brand_id,sum_sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                              HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum,isEmpty,sum] [sum(sales),sum(number_salesL),sum_sales,number_sales,sum,isEmpty,sum]
                                HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                                  InputAdapter
                                    Union
                                      WholeStageCodegen (185)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ss_quantity as decimal(10,0)) * ss_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #2
                                      WholeStageCodegen (211)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(cs_quantity as decimal(10,0)) * cs_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #15
                                      WholeStageCodegen (237)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ws_quantity as decimal(10,0)) * ws_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #16
                  WholeStageCodegen (319)
                    HashAggregate [channel,sum,isEmpty,sum] [sum(sum_sales),sum(number_salesL),i_brand_id,i_class_id,i_category_id,sum(sum_sales),sum(number_sales),sum,isEmpty,sum]
                      InputAdapter
                        Exchange [channel] #19
                          WholeStageCodegen (318)
                            HashAggregate [channel,sum_sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                              HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum,isEmpty,sum] [sum(sales),sum(number_salesL),sum_sales,number_sales,sum,isEmpty,sum]
                                HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                                  InputAdapter
                                    Union
                                      WholeStageCodegen (265)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ss_quantity as decimal(10,0)) * ss_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #2
                                      WholeStageCodegen (291)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(cs_quantity as decimal(10,0)) * cs_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #15
                                      WholeStageCodegen (317)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ws_quantity as decimal(10,0)) * ws_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #16
                  WholeStageCodegen (399)
                    HashAggregate [sum,isEmpty,sum] [sum(sum_sales),sum(number_salesL),channel,i_brand_id,i_class_id,i_category_id,sum(sum_sales),sum(number_sales),sum,isEmpty,sum]
                      InputAdapter
                        Exchange #20
                          WholeStageCodegen (398)
                            HashAggregate [sum_sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                              HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sum,isEmpty,sum] [sum(sales),sum(number_salesL),sum_sales,number_sales,sum,isEmpty,sum]
                                HashAggregate [channel,i_brand_id,i_class_id,i_category_id,sales,number_sales] [sum,isEmpty,sum,sum,isEmpty,sum]
                                  InputAdapter
                                    Union
                                      WholeStageCodegen (345)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ss_quantity as decimal(10,0)) * ss_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #2
                                      WholeStageCodegen (371)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(cs_quantity as decimal(10,0)) * cs_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #15
                                      WholeStageCodegen (397)
                                        Filter [sales]
                                          ReusedSubquery [average_sales] #3
                                          HashAggregate [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] [sum((cast(ws_quantity as decimal(10,0)) * ws_list_price)),count(1),channel,sales,number_sales,sum,isEmpty,count]
                                            InputAdapter
                                              ReusedExchange [i_brand_id,i_class_id,i_category_id,sum,isEmpty,count] #16
