TakeOrderedAndProject [w_state,i_item_id,sales_before,sales_after]
  WholeStageCodegen (9)
    HashAggregate [w_state,i_item_id,sum,isEmpty,sum,isEmpty] [sum(CASE WHEN (d_date < 2000-03-11) THEN (cs_sales_price - coalesce(cast(cr_refunded_cash as decimal(12,2)), 0.00)) ELSE 0.00 END),sum(CASE WHEN (d_date >= 2000-03-11) THEN (cs_sales_price - coalesce(cast(cr_refunded_cash as decimal(12,2)), 0.00)) ELSE 0.00 END),sales_before,sales_after,sum,isEmpty,sum,isEmpty]
      InputAdapter
        Exchange [w_state,i_item_id] #1
          WholeStageCodegen (8)
            HashAggregate [w_state,i_item_id,d_date,cs_sales_price,cr_refunded_cash] [sum,isEmpty,sum,isEmpty,sum,isEmpty,sum,isEmpty]
              Project [cs_sales_price,cr_refunded_cash,w_state,i_item_id,d_date]
                BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                  Project [cs_sales_price,cs_sold_date_sk,cr_refunded_cash,w_state,i_item_id]
                    BroadcastHashJoin [cs_item_sk,i_item_sk]
                      Project [cs_item_sk,cs_sales_price,cs_sold_date_sk,cr_refunded_cash,w_state]
                        BroadcastHashJoin [cs_warehouse_sk,w_warehouse_sk]
                          Project [cs_warehouse_sk,cs_item_sk,cs_sales_price,cs_sold_date_sk,cr_refunded_cash]
                            SortMergeJoin [cs_order_number,cs_item_sk,cr_order_number,cr_item_sk]
                              InputAdapter
                                WholeStageCodegen (2)
                                  Sort [cs_order_number,cs_item_sk]
                                    InputAdapter
                                      Exchange [cs_order_number,cs_item_sk] #2
                                        WholeStageCodegen (1)
                                          Filter [cs_warehouse_sk,cs_item_sk]
                                            ColumnarToRow
                                              InputAdapter
                                                Scan parquet spark_catalog.default.catalog_sales [cs_warehouse_sk,cs_item_sk,cs_order_number,cs_sales_price,cs_sold_date_sk]
                                                  SubqueryBroadcast [d_date_sk] #1
                                                    BroadcastExchange #3
                                                      WholeStageCodegen (1)
                                                        Filter [d_date,d_date_sk]
                                                          ColumnarToRow
                                                            InputAdapter
                                                              Scan parquet spark_catalog.default.date_dim [d_date_sk,d_date]
                              InputAdapter
                                WholeStageCodegen (4)
                                  Sort [cr_order_number,cr_item_sk]
                                    InputAdapter
                                      Exchange [cr_order_number,cr_item_sk] #4
                                        WholeStageCodegen (3)
                                          Project [cr_item_sk,cr_order_number,cr_refunded_cash]
                                            Filter [cr_order_number,cr_item_sk]
                                              ColumnarToRow
                                                InputAdapter
                                                  Scan parquet spark_catalog.default.catalog_returns [cr_item_sk,cr_order_number,cr_refunded_cash,cr_returned_date_sk]
                          InputAdapter
                            BroadcastExchange #5
                              WholeStageCodegen (5)
                                Filter [w_warehouse_sk]
                                  ColumnarToRow
                                    InputAdapter
                                      Scan parquet spark_catalog.default.warehouse [w_warehouse_sk,w_state]
                      InputAdapter
                        BroadcastExchange #6
                          WholeStageCodegen (6)
                            Project [i_item_sk,i_item_id]
                              Filter [i_current_price,i_item_sk]
                                ColumnarToRow
                                  InputAdapter
                                    Scan parquet spark_catalog.default.item [i_item_sk,i_item_id,i_current_price]
                  InputAdapter
                    ReusedExchange [d_date_sk,d_date] #3
