TakeOrderedAndProject [c_last_name,c_first_name,sales]
  Union
    WholeStageCodegen (18)
      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 (17)
              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 (6)
                              Sort [cs_bill_customer_sk]
                                InputAdapter
                                  Exchange [cs_bill_customer_sk] #2
                                    WholeStageCodegen (5)
                                      Project [cs_bill_customer_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                        BroadcastHashJoin [cs_item_sk,item_sk]
                                          Filter [cs_bill_customer_sk]
                                            ColumnarToRow
                                              InputAdapter
                                                Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                          InputAdapter
                                            BroadcastExchange #3
                                              WholeStageCodegen (4)
                                                Project [item_sk]
                                                  Filter [cnt]
                                                    HashAggregate [_groupingexpression,i_item_sk,d_date,count] [count(1),item_sk,cnt,count]
                                                      InputAdapter
                                                        Exchange [_groupingexpression,i_item_sk,d_date] #4
                                                          WholeStageCodegen (3)
                                                            HashAggregate [_groupingexpression,i_item_sk,d_date] [count,count]
                                                              Project [d_date,i_item_sk,i_item_desc]
                                                                BroadcastHashJoin [ss_item_sk,i_item_sk]
                                                                  Project [ss_item_sk,d_date]
                                                                    BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                      Filter [ss_item_sk]
                                                                        ColumnarToRow
                                                                          InputAdapter
                                                                            Scan parquet spark_catalog.default.store_sales [ss_item_sk,ss_sold_date_sk]
                                                                      InputAdapter
                                                                        BroadcastExchange #5
                                                                          WholeStageCodegen (1)
                                                                            Project [d_date_sk,d_date]
                                                                              Filter [d_year,d_date_sk]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet spark_catalog.default.date_dim [d_date_sk,d_date,d_year]
                                                                  InputAdapter
                                                                    BroadcastExchange #6
                                                                      WholeStageCodegen (2)
                                                                        Filter [i_item_sk]
                                                                          ColumnarToRow
                                                                            InputAdapter
                                                                              Scan parquet spark_catalog.default.item [i_item_sk,i_item_desc]
                          InputAdapter
                            WholeStageCodegen (9)
                              Sort [c_customer_sk]
                                Project [c_customer_sk]
                                  Filter [ssales]
                                    Subquery #1
                                      WholeStageCodegen (5)
                                        HashAggregate [max] [max(csales),tpcds_cmax,max]
                                          InputAdapter
                                            Exchange #9
                                              WholeStageCodegen (4)
                                                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 (3)
                                                          HashAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum,isEmpty,sum,isEmpty]
                                                            Project [ss_quantity,ss_sales_price,c_customer_sk]
                                                              BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                Project [ss_quantity,ss_sales_price,ss_sold_date_sk,c_customer_sk]
                                                                  BroadcastHashJoin [ss_customer_sk,c_customer_sk]
                                                                    Filter [ss_customer_sk]
                                                                      ColumnarToRow
                                                                        InputAdapter
                                                                          Scan parquet spark_catalog.default.store_sales [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                                    InputAdapter
                                                                      ReusedExchange [c_customer_sk] #8
                                                                InputAdapter
                                                                  BroadcastExchange #11
                                                                    WholeStageCodegen (2)
                                                                      Project [d_date_sk]
                                                                        Filter [d_year,d_date_sk]
                                                                          ColumnarToRow
                                                                            InputAdapter
                                                                              Scan parquet 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 (8)
                                            HashAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum,isEmpty,sum,isEmpty]
                                              Project [ss_quantity,ss_sales_price,c_customer_sk]
                                                BroadcastHashJoin [ss_customer_sk,c_customer_sk]
                                                  Project [ss_customer_sk,ss_quantity,ss_sales_price]
                                                    Filter [ss_customer_sk]
                                                      ColumnarToRow
                                                        InputAdapter
                                                          Scan parquet spark_catalog.default.store_sales [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                  InputAdapter
                                                    BroadcastExchange #8
                                                      WholeStageCodegen (7)
                                                        Filter [c_customer_sk]
                                                          ColumnarToRow
                                                            InputAdapter
                                                              Scan parquet spark_catalog.default.customer [c_customer_sk]
                        InputAdapter
                          BroadcastExchange #12
                            WholeStageCodegen (15)
                              SortMergeJoin [c_customer_sk,c_customer_sk]
                                InputAdapter
                                  WholeStageCodegen (11)
                                    Sort [c_customer_sk]
                                      InputAdapter
                                        Exchange [c_customer_sk] #13
                                          WholeStageCodegen (10)
                                            Filter [c_customer_sk]
                                              ColumnarToRow
                                                InputAdapter
                                                  Scan parquet spark_catalog.default.customer [c_customer_sk,c_first_name,c_last_name]
                                InputAdapter
                                  WholeStageCodegen (14)
                                    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 (16)
                          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]
    WholeStageCodegen (36)
      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 (35)
              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 (24)
                              Sort [ws_bill_customer_sk]
                                InputAdapter
                                  Exchange [ws_bill_customer_sk] #16
                                    WholeStageCodegen (23)
                                      Project [ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                        BroadcastHashJoin [ws_item_sk,item_sk]
                                          Filter [ws_bill_customer_sk]
                                            ColumnarToRow
                                              InputAdapter
                                                Scan parquet spark_catalog.default.web_sales [ws_item_sk,ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                          InputAdapter
                                            ReusedExchange [item_sk] #3
                          InputAdapter
                            WholeStageCodegen (27)
                              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
