TakeOrderedAndProject [c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset,ca_location_type,ctr_total_return]
  WholeStageCodegen (20)
    Project [c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset,ca_location_type,ctr_total_return]
      BroadcastHashJoin [ctr_state,ctr_state,ctr_total_return,(avg(ctr_total_return) * 1.2)]
        Project [c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset,ca_location_type,ctr_state,ctr_total_return]
          SortMergeJoin [c_customer_sk,ctr_customer_sk]
            InputAdapter
              WholeStageCodegen (3)
                Sort [c_customer_sk]
                  InputAdapter
                    Exchange [c_customer_sk] #1
                      WholeStageCodegen (2)
                        Project [c_customer_sk,c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset,ca_location_type]
                          BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                            Filter [c_customer_sk,c_current_addr_sk]
                              ColumnarToRow
                                InputAdapter
                                  Scan parquet spark_catalog.default.customer [c_customer_sk,c_customer_id,c_current_addr_sk,c_salutation,c_first_name,c_last_name]
                            InputAdapter
                              BroadcastExchange #2
                                WholeStageCodegen (1)
                                  Filter [ca_state,ca_address_sk]
                                    ColumnarToRow
                                      InputAdapter
                                        Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_street_number,ca_street_name,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset,ca_location_type]
            InputAdapter
              WholeStageCodegen (11)
                Sort [ctr_customer_sk]
                  InputAdapter
                    Exchange [ctr_customer_sk] #3
                      WholeStageCodegen (10)
                        Filter [ctr_total_return]
                          HashAggregate [cr_returning_customer_sk,ca_state,sum] [sum(UnscaledValue(cr_return_amt_inc_tax)),ctr_customer_sk,ctr_state,ctr_total_return,sum]
                            InputAdapter
                              Exchange [cr_returning_customer_sk,ca_state] #4
                                WholeStageCodegen (9)
                                  HashAggregate [cr_returning_customer_sk,ca_state,cr_return_amt_inc_tax] [sum,sum]
                                    Project [cr_returning_customer_sk,cr_return_amt_inc_tax,ca_state]
                                      SortMergeJoin [cr_returning_addr_sk,ca_address_sk]
                                        InputAdapter
                                          WholeStageCodegen (6)
                                            Sort [cr_returning_addr_sk]
                                              InputAdapter
                                                Exchange [cr_returning_addr_sk] #5
                                                  WholeStageCodegen (5)
                                                    Project [cr_returning_customer_sk,cr_returning_addr_sk,cr_return_amt_inc_tax]
                                                      BroadcastHashJoin [cr_returned_date_sk,d_date_sk]
                                                        Filter [cr_returning_addr_sk,cr_returning_customer_sk]
                                                          ColumnarToRow
                                                            InputAdapter
                                                              Scan parquet spark_catalog.default.catalog_returns [cr_returning_customer_sk,cr_returning_addr_sk,cr_return_amt_inc_tax,cr_returned_date_sk]
                                                                SubqueryBroadcast [d_date_sk] #1
                                                                  BroadcastExchange #6
                                                                    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] #6
                                        InputAdapter
                                          WholeStageCodegen (8)
                                            Sort [ca_address_sk]
                                              InputAdapter
                                                Exchange [ca_address_sk] #7
                                                  WholeStageCodegen (7)
                                                    Filter [ca_address_sk,ca_state]
                                                      ColumnarToRow
                                                        InputAdapter
                                                          Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_state]
        InputAdapter
          BroadcastExchange #8
            WholeStageCodegen (19)
              Filter [(avg(ctr_total_return) * 1.2)]
                HashAggregate [ctr_state,sum,count] [avg(ctr_total_return),(avg(ctr_total_return) * 1.2),sum,count]
                  InputAdapter
                    Exchange [ctr_state] #9
                      WholeStageCodegen (18)
                        HashAggregate [ctr_state,ctr_total_return] [sum,count,sum,count]
                          HashAggregate [cr_returning_customer_sk,ca_state,sum] [sum(UnscaledValue(cr_return_amt_inc_tax)),ctr_state,ctr_total_return,sum]
                            InputAdapter
                              Exchange [cr_returning_customer_sk,ca_state] #10
                                WholeStageCodegen (17)
                                  HashAggregate [cr_returning_customer_sk,ca_state,cr_return_amt_inc_tax] [sum,sum]
                                    Project [cr_returning_customer_sk,cr_return_amt_inc_tax,ca_state]
                                      SortMergeJoin [cr_returning_addr_sk,ca_address_sk]
                                        InputAdapter
                                          WholeStageCodegen (14)
                                            Sort [cr_returning_addr_sk]
                                              InputAdapter
                                                Exchange [cr_returning_addr_sk] #11
                                                  WholeStageCodegen (13)
                                                    Project [cr_returning_customer_sk,cr_returning_addr_sk,cr_return_amt_inc_tax]
                                                      BroadcastHashJoin [cr_returned_date_sk,d_date_sk]
                                                        Filter [cr_returning_addr_sk]
                                                          ColumnarToRow
                                                            InputAdapter
                                                              Scan parquet spark_catalog.default.catalog_returns [cr_returning_customer_sk,cr_returning_addr_sk,cr_return_amt_inc_tax,cr_returned_date_sk]
                                                                ReusedSubquery [d_date_sk] #1
                                                        InputAdapter
                                                          ReusedExchange [d_date_sk] #6
                                        InputAdapter
                                          WholeStageCodegen (16)
                                            Sort [ca_address_sk]
                                              InputAdapter
                                                ReusedExchange [ca_address_sk,ca_state] #7
