TakeOrderedAndProject [channel,return_rank,currency_rank,item,return_ratio]
  WholeStageCodegen (32)
    HashAggregate [channel,item,return_ratio,return_rank,currency_rank]
      InputAdapter
        Exchange [channel,item,return_ratio,return_rank,currency_rank] #1
          WholeStageCodegen (31)
            HashAggregate [channel,item,return_ratio,return_rank,currency_rank]
              InputAdapter
                Union
                  WholeStageCodegen (10)
                    Project [item,return_ratio,return_rank,currency_rank]
                      Filter [return_rank,currency_rank]
                        InputAdapter
                          Window [currency_ratio]
                            WholeStageCodegen (9)
                              Sort [currency_ratio]
                                InputAdapter
                                  Window [return_ratio]
                                    WholeStageCodegen (8)
                                      Sort [return_ratio]
                                        InputAdapter
                                          Exchange #2
                                            WholeStageCodegen (7)
                                              HashAggregate [ws_item_sk,sum,sum,sum,isEmpty,sum,isEmpty] [sum(coalesce(wr_return_quantity, 0)),sum(coalesce(ws_quantity, 0)),sum(coalesce(cast(wr_return_amt as decimal(12,2)), 0.00)),sum(coalesce(cast(ws_net_paid as decimal(12,2)), 0.00)),item,return_ratio,currency_ratio,sum,sum,sum,isEmpty,sum,isEmpty]
                                                InputAdapter
                                                  Exchange [ws_item_sk] #3
                                                    WholeStageCodegen (6)
                                                      HashAggregate [ws_item_sk,wr_return_quantity,ws_quantity,wr_return_amt,ws_net_paid] [sum,sum,sum,isEmpty,sum,isEmpty,sum,sum,sum,isEmpty,sum,isEmpty]
                                                        Project [ws_item_sk,ws_quantity,ws_net_paid,wr_return_quantity,wr_return_amt]
                                                          SortMergeJoin [ws_order_number,ws_item_sk,wr_order_number,wr_item_sk]
                                                            InputAdapter
                                                              WholeStageCodegen (3)
                                                                Sort [ws_order_number,ws_item_sk]
                                                                  InputAdapter
                                                                    Exchange [ws_order_number,ws_item_sk] #4
                                                                      WholeStageCodegen (2)
                                                                        Project [ws_item_sk,ws_order_number,ws_quantity,ws_net_paid]
                                                                          BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                                            Project [ws_item_sk,ws_order_number,ws_quantity,ws_net_paid,ws_sold_date_sk]
                                                                              Filter [ws_net_profit,ws_net_paid,ws_quantity,ws_order_number,ws_item_sk]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet spark_catalog.default.web_sales [ws_item_sk,ws_order_number,ws_quantity,ws_net_paid,ws_net_profit,ws_sold_date_sk]
                                                                                      SubqueryBroadcast [d_date_sk] #1
                                                                                        BroadcastExchange #5
                                                                                          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
                                                                              ReusedExchange [d_date_sk] #5
                                                            InputAdapter
                                                              WholeStageCodegen (5)
                                                                Sort [wr_order_number,wr_item_sk]
                                                                  InputAdapter
                                                                    Exchange [wr_order_number,wr_item_sk] #6
                                                                      WholeStageCodegen (4)
                                                                        Project [wr_item_sk,wr_order_number,wr_return_quantity,wr_return_amt]
                                                                          Filter [wr_return_amt,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]
                  WholeStageCodegen (20)
                    Project [item,return_ratio,return_rank,currency_rank]
                      Filter [return_rank,currency_rank]
                        InputAdapter
                          Window [currency_ratio]
                            WholeStageCodegen (19)
                              Sort [currency_ratio]
                                InputAdapter
                                  Window [return_ratio]
                                    WholeStageCodegen (18)
                                      Sort [return_ratio]
                                        InputAdapter
                                          Exchange #7
                                            WholeStageCodegen (17)
                                              HashAggregate [cs_item_sk,sum,sum,sum,isEmpty,sum,isEmpty] [sum(coalesce(cr_return_quantity, 0)),sum(coalesce(cs_quantity, 0)),sum(coalesce(cast(cr_return_amount as decimal(12,2)), 0.00)),sum(coalesce(cast(cs_net_paid as decimal(12,2)), 0.00)),item,return_ratio,currency_ratio,sum,sum,sum,isEmpty,sum,isEmpty]
                                                InputAdapter
                                                  Exchange [cs_item_sk] #8
                                                    WholeStageCodegen (16)
                                                      HashAggregate [cs_item_sk,cr_return_quantity,cs_quantity,cr_return_amount,cs_net_paid] [sum,sum,sum,isEmpty,sum,isEmpty,sum,sum,sum,isEmpty,sum,isEmpty]
                                                        Project [cs_item_sk,cs_quantity,cs_net_paid,cr_return_quantity,cr_return_amount]
                                                          SortMergeJoin [cs_order_number,cs_item_sk,cr_order_number,cr_item_sk]
                                                            InputAdapter
                                                              WholeStageCodegen (13)
                                                                Sort [cs_order_number,cs_item_sk]
                                                                  InputAdapter
                                                                    Exchange [cs_order_number,cs_item_sk] #9
                                                                      WholeStageCodegen (12)
                                                                        Project [cs_item_sk,cs_order_number,cs_quantity,cs_net_paid]
                                                                          BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                                            Project [cs_item_sk,cs_order_number,cs_quantity,cs_net_paid,cs_sold_date_sk]
                                                                              Filter [cs_net_profit,cs_net_paid,cs_quantity,cs_order_number,cs_item_sk]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet spark_catalog.default.catalog_sales [cs_item_sk,cs_order_number,cs_quantity,cs_net_paid,cs_net_profit,cs_sold_date_sk]
                                                                                      ReusedSubquery [d_date_sk] #1
                                                                            InputAdapter
                                                                              ReusedExchange [d_date_sk] #5
                                                            InputAdapter
                                                              WholeStageCodegen (15)
                                                                Sort [cr_order_number,cr_item_sk]
                                                                  InputAdapter
                                                                    Exchange [cr_order_number,cr_item_sk] #10
                                                                      WholeStageCodegen (14)
                                                                        Project [cr_item_sk,cr_order_number,cr_return_quantity,cr_return_amount]
                                                                          Filter [cr_return_amount,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 (30)
                    Project [item,return_ratio,return_rank,currency_rank]
                      Filter [return_rank,currency_rank]
                        InputAdapter
                          Window [currency_ratio]
                            WholeStageCodegen (29)
                              Sort [currency_ratio]
                                InputAdapter
                                  Window [return_ratio]
                                    WholeStageCodegen (28)
                                      Sort [return_ratio]
                                        InputAdapter
                                          Exchange #11
                                            WholeStageCodegen (27)
                                              HashAggregate [ss_item_sk,sum,sum,sum,isEmpty,sum,isEmpty] [sum(coalesce(sr_return_quantity, 0)),sum(coalesce(ss_quantity, 0)),sum(coalesce(cast(sr_return_amt as decimal(12,2)), 0.00)),sum(coalesce(cast(ss_net_paid as decimal(12,2)), 0.00)),item,return_ratio,currency_ratio,sum,sum,sum,isEmpty,sum,isEmpty]
                                                InputAdapter
                                                  Exchange [ss_item_sk] #12
                                                    WholeStageCodegen (26)
                                                      HashAggregate [ss_item_sk,sr_return_quantity,ss_quantity,sr_return_amt,ss_net_paid] [sum,sum,sum,isEmpty,sum,isEmpty,sum,sum,sum,isEmpty,sum,isEmpty]
                                                        Project [ss_item_sk,ss_quantity,ss_net_paid,sr_return_quantity,sr_return_amt]
                                                          SortMergeJoin [ss_ticket_number,ss_item_sk,sr_ticket_number,sr_item_sk]
                                                            InputAdapter
                                                              WholeStageCodegen (23)
                                                                Sort [ss_ticket_number,ss_item_sk]
                                                                  InputAdapter
                                                                    Exchange [ss_ticket_number,ss_item_sk] #13
                                                                      WholeStageCodegen (22)
                                                                        Project [ss_item_sk,ss_ticket_number,ss_quantity,ss_net_paid]
                                                                          BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                            Project [ss_item_sk,ss_ticket_number,ss_quantity,ss_net_paid,ss_sold_date_sk]
                                                                              Filter [ss_net_profit,ss_net_paid,ss_quantity,ss_ticket_number,ss_item_sk]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet spark_catalog.default.store_sales [ss_item_sk,ss_ticket_number,ss_quantity,ss_net_paid,ss_net_profit,ss_sold_date_sk]
                                                                                      ReusedSubquery [d_date_sk] #1
                                                                            InputAdapter
                                                                              ReusedExchange [d_date_sk] #5
                                                            InputAdapter
                                                              WholeStageCodegen (25)
                                                                Sort [sr_ticket_number,sr_item_sk]
                                                                  InputAdapter
                                                                    Exchange [sr_ticket_number,sr_item_sk] #14
                                                                      WholeStageCodegen (24)
                                                                        Project [sr_item_sk,sr_ticket_number,sr_return_quantity,sr_return_amt]
                                                                          Filter [sr_return_amt,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]
