TakeOrderedAndProject [sales_cnt_diff,sales_amt_diff,prev_year,year,i_brand_id,i_class_id,i_category_id,i_manufact_id,prev_yr_cnt,curr_yr_cnt]
  WholeStageCodegen (51)
    Project [d_year,d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_cnt,sales_amt,sales_amt]
      SortMergeJoin [i_brand_id,i_class_id,i_category_id,i_manufact_id,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_cnt]
        InputAdapter
          WholeStageCodegen (25)
            Sort [i_brand_id,i_class_id,i_category_id,i_manufact_id]
              InputAdapter
                Exchange [i_brand_id,i_class_id,i_category_id,i_manufact_id] #1
                  WholeStageCodegen (24)
                    Filter [sales_cnt]
                      HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sum,sum] [sum(sales_cnt),sum(UnscaledValue(sales_amt)),sales_cnt,sales_amt,sum,sum]
                        InputAdapter
                          Exchange [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id] #2
                            WholeStageCodegen (23)
                              HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt] [sum,sum,sum,sum]
                                HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt]
                                  InputAdapter
                                    Exchange [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt] #3
                                      WholeStageCodegen (22)
                                        HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt]
                                          InputAdapter
                                            Union
                                              WholeStageCodegen (7)
                                                Project [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,cs_quantity,cr_return_quantity,cs_ext_sales_price,cr_return_amount]
                                                  SortMergeJoin [cs_order_number,cs_item_sk,cr_order_number,cr_item_sk]
                                                    InputAdapter
                                                      WholeStageCodegen (4)
                                                        Sort [cs_order_number,cs_item_sk]
                                                          InputAdapter
                                                            Exchange [cs_order_number,cs_item_sk] #4
                                                              WholeStageCodegen (3)
                                                                Project [cs_item_sk,cs_order_number,cs_quantity,cs_ext_sales_price,i_brand_id,i_class_id,i_category_id,i_manufact_id,d_year]
                                                                  BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                                    Project [cs_item_sk,cs_order_number,cs_quantity,cs_ext_sales_price,cs_sold_date_sk,i_brand_id,i_class_id,i_category_id,i_manufact_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_order_number,cs_quantity,cs_ext_sales_price,cs_sold_date_sk]
                                                                                SubqueryBroadcast [d_date_sk] #1
                                                                                  BroadcastExchange #5
                                                                                    WholeStageCodegen (1)
                                                                                      Filter [d_year,d_date_sk]
                                                                                        ColumnarToRow
                                                                                          InputAdapter
                                                                                            Scan parquet spark_catalog.default.date_dim [d_date_sk,d_year]
                                                                        InputAdapter
                                                                          BroadcastExchange #6
                                                                            WholeStageCodegen (1)
                                                                              Project [i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id]
                                                                                Filter [i_category,i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id]
                                                                                  ColumnarToRow
                                                                                    InputAdapter
                                                                                      Scan parquet spark_catalog.default.item [i_item_sk,i_brand_id,i_class_id,i_category_id,i_category,i_manufact_id]
                                                                    InputAdapter
                                                                      ReusedExchange [d_date_sk,d_year] #5
                                                    InputAdapter
                                                      WholeStageCodegen (6)
                                                        Sort [cr_order_number,cr_item_sk]
                                                          InputAdapter
                                                            Exchange [cr_order_number,cr_item_sk] #7
                                                              WholeStageCodegen (5)
                                                                Project [cr_item_sk,cr_order_number,cr_return_quantity,cr_return_amount]
                                                                  Filter [cr_order_number,cr_item_sk]
                                                                    ColumnarToRow
                                                                      InputAdapter
                                                                        Scan parquet spark_catalog.default.catalog_returns [cr_item_sk,cr_order_number,cr_return_quantity,cr_return_amount,cr_returned_date_sk]
                                              WholeStageCodegen (14)
                                                Project [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,ss_quantity,sr_return_quantity,ss_ext_sales_price,sr_return_amt]
                                                  SortMergeJoin [ss_ticket_number,ss_item_sk,sr_ticket_number,sr_item_sk]
                                                    InputAdapter
                                                      WholeStageCodegen (11)
                                                        Sort [ss_ticket_number,ss_item_sk]
                                                          InputAdapter
                                                            Exchange [ss_ticket_number,ss_item_sk] #8
                                                              WholeStageCodegen (10)
                                                                Project [ss_item_sk,ss_ticket_number,ss_quantity,ss_ext_sales_price,i_brand_id,i_class_id,i_category_id,i_manufact_id,d_year]
                                                                  BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                    Project [ss_item_sk,ss_ticket_number,ss_quantity,ss_ext_sales_price,ss_sold_date_sk,i_brand_id,i_class_id,i_category_id,i_manufact_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_ticket_number,ss_quantity,ss_ext_sales_price,ss_sold_date_sk]
                                                                                ReusedSubquery [d_date_sk] #1
                                                                        InputAdapter
                                                                          ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id] #6
                                                                    InputAdapter
                                                                      ReusedExchange [d_date_sk,d_year] #5
                                                    InputAdapter
                                                      WholeStageCodegen (13)
                                                        Sort [sr_ticket_number,sr_item_sk]
                                                          InputAdapter
                                                            Exchange [sr_ticket_number,sr_item_sk] #9
                                                              WholeStageCodegen (12)
                                                                Project [sr_item_sk,sr_ticket_number,sr_return_quantity,sr_return_amt]
                                                                  Filter [sr_ticket_number,sr_item_sk]
                                                                    ColumnarToRow
                                                                      InputAdapter
                                                                        Scan parquet spark_catalog.default.store_returns [sr_item_sk,sr_ticket_number,sr_return_quantity,sr_return_amt,sr_returned_date_sk]
                                              WholeStageCodegen (21)
                                                Project [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,ws_quantity,wr_return_quantity,ws_ext_sales_price,wr_return_amt]
                                                  SortMergeJoin [ws_order_number,ws_item_sk,wr_order_number,wr_item_sk]
                                                    InputAdapter
                                                      WholeStageCodegen (18)
                                                        Sort [ws_order_number,ws_item_sk]
                                                          InputAdapter
                                                            Exchange [ws_order_number,ws_item_sk] #10
                                                              WholeStageCodegen (17)
                                                                Project [ws_item_sk,ws_order_number,ws_quantity,ws_ext_sales_price,i_brand_id,i_class_id,i_category_id,i_manufact_id,d_year]
                                                                  BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                                    Project [ws_item_sk,ws_order_number,ws_quantity,ws_ext_sales_price,ws_sold_date_sk,i_brand_id,i_class_id,i_category_id,i_manufact_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_order_number,ws_quantity,ws_ext_sales_price,ws_sold_date_sk]
                                                                                ReusedSubquery [d_date_sk] #1
                                                                        InputAdapter
                                                                          ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id] #6
                                                                    InputAdapter
                                                                      ReusedExchange [d_date_sk,d_year] #5
                                                    InputAdapter
                                                      WholeStageCodegen (20)
                                                        Sort [wr_order_number,wr_item_sk]
                                                          InputAdapter
                                                            Exchange [wr_order_number,wr_item_sk] #11
                                                              WholeStageCodegen (19)
                                                                Project [wr_item_sk,wr_order_number,wr_return_quantity,wr_return_amt]
                                                                  Filter [wr_order_number,wr_item_sk]
                                                                    ColumnarToRow
                                                                      InputAdapter
                                                                        Scan parquet spark_catalog.default.web_returns [wr_item_sk,wr_order_number,wr_return_quantity,wr_return_amt,wr_returned_date_sk]
        InputAdapter
          WholeStageCodegen (50)
            Sort [i_brand_id,i_class_id,i_category_id,i_manufact_id]
              InputAdapter
                Exchange [i_brand_id,i_class_id,i_category_id,i_manufact_id] #12
                  WholeStageCodegen (49)
                    Filter [sales_cnt]
                      HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sum,sum] [sum(sales_cnt),sum(UnscaledValue(sales_amt)),sales_cnt,sales_amt,sum,sum]
                        InputAdapter
                          Exchange [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id] #13
                            WholeStageCodegen (48)
                              HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt] [sum,sum,sum,sum]
                                HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt]
                                  InputAdapter
                                    Exchange [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt] #14
                                      WholeStageCodegen (47)
                                        HashAggregate [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,sales_cnt,sales_amt]
                                          InputAdapter
                                            Union
                                              WholeStageCodegen (32)
                                                Project [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,cs_quantity,cr_return_quantity,cs_ext_sales_price,cr_return_amount]
                                                  SortMergeJoin [cs_order_number,cs_item_sk,cr_order_number,cr_item_sk]
                                                    InputAdapter
                                                      WholeStageCodegen (29)
                                                        Sort [cs_order_number,cs_item_sk]
                                                          InputAdapter
                                                            Exchange [cs_order_number,cs_item_sk] #15
                                                              WholeStageCodegen (28)
                                                                Project [cs_item_sk,cs_order_number,cs_quantity,cs_ext_sales_price,i_brand_id,i_class_id,i_category_id,i_manufact_id,d_year]
                                                                  BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                                    Project [cs_item_sk,cs_order_number,cs_quantity,cs_ext_sales_price,cs_sold_date_sk,i_brand_id,i_class_id,i_category_id,i_manufact_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_order_number,cs_quantity,cs_ext_sales_price,cs_sold_date_sk]
                                                                                SubqueryBroadcast [d_date_sk] #2
                                                                                  BroadcastExchange #16
                                                                                    WholeStageCodegen (1)
                                                                                      Filter [d_year,d_date_sk]
                                                                                        ColumnarToRow
                                                                                          InputAdapter
                                                                                            Scan parquet spark_catalog.default.date_dim [d_date_sk,d_year]
                                                                        InputAdapter
                                                                          ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id] #6
                                                                    InputAdapter
                                                                      ReusedExchange [d_date_sk,d_year] #16
                                                    InputAdapter
                                                      WholeStageCodegen (31)
                                                        Sort [cr_order_number,cr_item_sk]
                                                          InputAdapter
                                                            ReusedExchange [cr_item_sk,cr_order_number,cr_return_quantity,cr_return_amount] #7
                                              WholeStageCodegen (39)
                                                Project [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,ss_quantity,sr_return_quantity,ss_ext_sales_price,sr_return_amt]
                                                  SortMergeJoin [ss_ticket_number,ss_item_sk,sr_ticket_number,sr_item_sk]
                                                    InputAdapter
                                                      WholeStageCodegen (36)
                                                        Sort [ss_ticket_number,ss_item_sk]
                                                          InputAdapter
                                                            Exchange [ss_ticket_number,ss_item_sk] #17
                                                              WholeStageCodegen (35)
                                                                Project [ss_item_sk,ss_ticket_number,ss_quantity,ss_ext_sales_price,i_brand_id,i_class_id,i_category_id,i_manufact_id,d_year]
                                                                  BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                    Project [ss_item_sk,ss_ticket_number,ss_quantity,ss_ext_sales_price,ss_sold_date_sk,i_brand_id,i_class_id,i_category_id,i_manufact_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_ticket_number,ss_quantity,ss_ext_sales_price,ss_sold_date_sk]
                                                                                ReusedSubquery [d_date_sk] #2
                                                                        InputAdapter
                                                                          ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id] #6
                                                                    InputAdapter
                                                                      ReusedExchange [d_date_sk,d_year] #16
                                                    InputAdapter
                                                      WholeStageCodegen (38)
                                                        Sort [sr_ticket_number,sr_item_sk]
                                                          InputAdapter
                                                            ReusedExchange [sr_item_sk,sr_ticket_number,sr_return_quantity,sr_return_amt] #9
                                              WholeStageCodegen (46)
                                                Project [d_year,i_brand_id,i_class_id,i_category_id,i_manufact_id,ws_quantity,wr_return_quantity,ws_ext_sales_price,wr_return_amt]
                                                  SortMergeJoin [ws_order_number,ws_item_sk,wr_order_number,wr_item_sk]
                                                    InputAdapter
                                                      WholeStageCodegen (43)
                                                        Sort [ws_order_number,ws_item_sk]
                                                          InputAdapter
                                                            Exchange [ws_order_number,ws_item_sk] #18
                                                              WholeStageCodegen (42)
                                                                Project [ws_item_sk,ws_order_number,ws_quantity,ws_ext_sales_price,i_brand_id,i_class_id,i_category_id,i_manufact_id,d_year]
                                                                  BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                                    Project [ws_item_sk,ws_order_number,ws_quantity,ws_ext_sales_price,ws_sold_date_sk,i_brand_id,i_class_id,i_category_id,i_manufact_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_order_number,ws_quantity,ws_ext_sales_price,ws_sold_date_sk]
                                                                                ReusedSubquery [d_date_sk] #2
                                                                        InputAdapter
                                                                          ReusedExchange [i_item_sk,i_brand_id,i_class_id,i_category_id,i_manufact_id] #6
                                                                    InputAdapter
                                                                      ReusedExchange [d_date_sk,d_year] #16
                                                    InputAdapter
                                                      WholeStageCodegen (45)
                                                        Sort [wr_order_number,wr_item_sk]
                                                          InputAdapter
                                                            ReusedExchange [wr_item_sk,wr_order_number,wr_return_quantity,wr_return_amt] #11
