TakeOrderedAndProject [c_last_name,c_first_name,sales]
  Union
    WholeStageCodegen (10)
      HashAggregate [c_last_name,c_first_name,sum,isEmpty] [sum((cast(cs_quantity as decimal(10,0)) * cs_list_price)),sales,sum,isEmpty]
        InputAdapter
          Exchange [c_last_name,c_first_name] #1
            WholeStageCodegen (9)
              HashAggregate [c_last_name,c_first_name,cs_quantity,cs_list_price] [sum,isEmpty,sum,isEmpty]
                Project [cs_quantity,cs_list_price,c_first_name,c_last_name]
                  BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                    Project [cs_quantity,cs_list_price,cs_sold_date_sk,c_first_name,c_last_name]
                      BroadcastHashJoin [cs_bill_customer_sk,c_customer_sk]
                        SortMergeJoin [cs_bill_customer_sk,c_customer_sk]
                          InputAdapter
                            WholeStageCodegen (1)
                              ColumnarToRow
                                InputAdapter
                                  CometSort [cs_bill_customer_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                    CometExchange [cs_bill_customer_sk] #2
                                      CometProject [cs_bill_customer_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                        CometBroadcastHashJoin [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sold_date_sk,item_sk]
                                          CometFilter [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                            CometNativeScan: `spark_catalog`.`default`.`catalog_sales` [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                          CometBroadcastExchange [item_sk] #3
                                            CometProject [item_sk]
                                              CometFilter [item_sk,cnt]
                                                CometHashAggregate [item_sk,cnt,_groupingexpression,i_item_sk,d_date,count,count(1)]
                                                  CometExchange [_groupingexpression,i_item_sk,d_date] #4
                                                    CometHashAggregate [_groupingexpression,i_item_sk,d_date,count]
                                                      CometProject [i_item_desc] [d_date,i_item_sk,_groupingexpression]
                                                        CometBroadcastHashJoin [ss_item_sk,d_date,i_item_sk,i_item_desc]
                                                          CometProject [ss_item_sk,d_date]
                                                            CometBroadcastHashJoin [ss_item_sk,ss_sold_date_sk,d_date_sk,d_date]
                                                              CometFilter [ss_item_sk,ss_sold_date_sk]
                                                                CometNativeScan: `spark_catalog`.`default`.`store_sales` [ss_item_sk,ss_sold_date_sk]
                                                              CometBroadcastExchange [d_date_sk,d_date] #5
                                                                CometProject [d_date_sk,d_date]
                                                                  CometFilter [d_date_sk,d_date,d_year]
                                                                    CometNativeScan: `spark_catalog`.`default`.`date_dim` [d_date_sk,d_date,d_year]
                                                          CometBroadcastExchange [i_item_sk,i_item_desc] #6
                                                            CometFilter [i_item_sk,i_item_desc]
                                                              CometNativeScan: `spark_catalog`.`default`.`item` [i_item_sk,i_item_desc]
                          InputAdapter
                            WholeStageCodegen (3)
                              Sort [c_customer_sk]
                                Project [c_customer_sk]
                                  Filter [ssales]
                                    Subquery #1
                                      WholeStageCodegen (3)
                                        HashAggregate [max] [max(csales),tpcds_cmax,max]
                                          InputAdapter
                                            Exchange #9
                                              WholeStageCodegen (2)
                                                HashAggregate [csales] [max,max]
                                                  HashAggregate [c_customer_sk,sum,isEmpty] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),csales,sum,isEmpty]
                                                    InputAdapter
                                                      Exchange [c_customer_sk] #10
                                                        WholeStageCodegen (1)
                                                          HashAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum,isEmpty,sum,isEmpty]
                                                            ColumnarToRow
                                                              InputAdapter
                                                                CometProject [ss_quantity,ss_sales_price,c_customer_sk]
                                                                  CometBroadcastHashJoin [ss_quantity,ss_sales_price,ss_sold_date_sk,c_customer_sk,d_date_sk]
                                                                    CometProject [ss_quantity,ss_sales_price,ss_sold_date_sk,c_customer_sk]
                                                                      CometBroadcastHashJoin [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk,c_customer_sk]
                                                                        CometFilter [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                                          CometNativeScan: `spark_catalog`.`default`.`store_sales` [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                                        ReusedExchange [c_customer_sk] #8
                                                                    CometBroadcastExchange [d_date_sk] #11
                                                                      CometProject [d_date_sk]
                                                                        CometFilter [d_date_sk,d_year]
                                                                          CometNativeScan: `spark_catalog`.`default`.`date_dim` [d_date_sk,d_year]
                                    HashAggregate [c_customer_sk,sum,isEmpty] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                      InputAdapter
                                        Exchange [c_customer_sk] #7
                                          WholeStageCodegen (2)
                                            HashAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum,isEmpty,sum,isEmpty]
                                              ColumnarToRow
                                                InputAdapter
                                                  CometProject [ss_quantity,ss_sales_price,c_customer_sk]
                                                    CometBroadcastHashJoin [ss_customer_sk,ss_quantity,ss_sales_price,c_customer_sk]
                                                      CometProject [ss_customer_sk,ss_quantity,ss_sales_price]
                                                        CometFilter [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                          CometNativeScan: `spark_catalog`.`default`.`store_sales` [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                      CometBroadcastExchange [c_customer_sk] #8
                                                        CometFilter [c_customer_sk]
                                                          CometNativeScan: `spark_catalog`.`default`.`customer` [c_customer_sk]
                        InputAdapter
                          BroadcastExchange #12
                            WholeStageCodegen (7)
                              SortMergeJoin [c_customer_sk,c_customer_sk]
                                InputAdapter
                                  WholeStageCodegen (4)
                                    ColumnarToRow
                                      InputAdapter
                                        CometSort [c_customer_sk,c_first_name,c_last_name]
                                          CometExchange [c_customer_sk] #13
                                            CometFilter [c_customer_sk,c_first_name,c_last_name]
                                              CometNativeScan: `spark_catalog`.`default`.`customer` [c_customer_sk,c_first_name,c_last_name]
                                InputAdapter
                                  WholeStageCodegen (6)
                                    Sort [c_customer_sk]
                                      Project [c_customer_sk]
                                        Filter [ssales]
                                          ReusedSubquery [tpcds_cmax] #1
                                          HashAggregate [c_customer_sk,sum,isEmpty] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                            InputAdapter
                                              ReusedExchange [c_customer_sk,sum,isEmpty] #7
                    InputAdapter
                      BroadcastExchange #14
                        WholeStageCodegen (8)
                          ColumnarToRow
                            InputAdapter
                              CometProject [d_date_sk]
                                CometFilter [d_date_sk,d_year,d_moy]
                                  CometNativeScan: `spark_catalog`.`default`.`date_dim` [d_date_sk,d_year,d_moy]
    WholeStageCodegen (20)
      HashAggregate [c_last_name,c_first_name,sum,isEmpty] [sum((cast(ws_quantity as decimal(10,0)) * ws_list_price)),sales,sum,isEmpty]
        InputAdapter
          Exchange [c_last_name,c_first_name] #15
            WholeStageCodegen (19)
              HashAggregate [c_last_name,c_first_name,ws_quantity,ws_list_price] [sum,isEmpty,sum,isEmpty]
                Project [ws_quantity,ws_list_price,c_first_name,c_last_name]
                  BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                    Project [ws_quantity,ws_list_price,ws_sold_date_sk,c_first_name,c_last_name]
                      BroadcastHashJoin [ws_bill_customer_sk,c_customer_sk]
                        SortMergeJoin [ws_bill_customer_sk,c_customer_sk]
                          InputAdapter
                            WholeStageCodegen (11)
                              ColumnarToRow
                                InputAdapter
                                  CometSort [ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                    CometExchange [ws_bill_customer_sk] #16
                                      CometProject [ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                        CometBroadcastHashJoin [ws_item_sk,ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk,item_sk]
                                          CometFilter [ws_item_sk,ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                            CometNativeScan: `spark_catalog`.`default`.`web_sales` [ws_item_sk,ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                          ReusedExchange [item_sk] #3
                          InputAdapter
                            WholeStageCodegen (13)
                              Sort [c_customer_sk]
                                Project [c_customer_sk]
                                  Filter [ssales]
                                    ReusedSubquery [tpcds_cmax] #1
                                    HashAggregate [c_customer_sk,sum,isEmpty] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                      InputAdapter
                                        ReusedExchange [c_customer_sk,sum,isEmpty] #7
                        InputAdapter
                          ReusedExchange [c_customer_sk,c_first_name,c_last_name] #12
                    InputAdapter
                      ReusedExchange [d_date_sk] #14
