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]
        CometColumnarToRow
          InputAdapter
            CometColumnarExchange [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)
                                CometColumnarToRow
                                  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]
                                              CometScan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                                SubqueryBroadcast [d_date_sk] #1
                                                  BroadcastExchange #3
                                                    WholeStageCodegen (1)
                                                      CometColumnarToRow
                                                        InputAdapter
                                                          CometProject [d_date_sk]
                                                            CometFilter [d_date_sk,d_year,d_moy]
                                                              CometScan parquet spark_catalog.default.date_dim [d_date_sk,d_year,d_moy]
                                            CometBroadcastExchange [item_sk] #4
                                              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] #5
                                                      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]
                                                                  CometScan parquet spark_catalog.default.store_sales [ss_item_sk,ss_sold_date_sk]
                                                                    SubqueryBroadcast [d_date_sk] #2
                                                                      BroadcastExchange #6
                                                                        WholeStageCodegen (1)
                                                                          CometColumnarToRow
                                                                            InputAdapter
                                                                              CometProject [d_date_sk,d_date]
                                                                                CometFilter [d_date_sk,d_date,d_year]
                                                                                  CometScan parquet spark_catalog.default.date_dim [d_date_sk,d_date,d_year]
                                                                CometBroadcastExchange [d_date_sk,d_date] #7
                                                                  CometProject [d_date_sk,d_date]
                                                                    CometFilter [d_date_sk,d_date,d_year]
                                                                      CometScan parquet spark_catalog.default.date_dim [d_date_sk,d_date,d_year]
                                                            CometBroadcastExchange [i_item_sk,i_item_desc] #8
                                                              CometFilter [i_item_sk,i_item_desc]
                                                                CometScan parquet spark_catalog.default.item [i_item_sk,i_item_desc]
                            InputAdapter
                              WholeStageCodegen (3)
                                Sort [c_customer_sk]
                                  Project [c_customer_sk]
                                    Filter [ssales]
                                      Subquery #3
                                        WholeStageCodegen (3)
                                          HashAggregate [max] [max(csales),tpcds_cmax,max]
                                            CometColumnarToRow
                                              InputAdapter
                                                CometColumnarExchange #11
                                                  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]
                                                        CometColumnarToRow
                                                          InputAdapter
                                                            CometColumnarExchange [c_customer_sk] #12
                                                              WholeStageCodegen (1)
                                                                HashAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum,isEmpty,sum,isEmpty]
                                                                  CometColumnarToRow
                                                                    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]
                                                                                CometScan parquet spark_catalog.default.store_sales [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                                                  SubqueryBroadcast [d_date_sk] #4
                                                                                    BroadcastExchange #13
                                                                                      WholeStageCodegen (1)
                                                                                        CometColumnarToRow
                                                                                          InputAdapter
                                                                                            CometProject [d_date_sk]
                                                                                              CometFilter [d_date_sk,d_year]
                                                                                                CometScan parquet spark_catalog.default.date_dim [d_date_sk,d_year]
                                                                              ReusedExchange [c_customer_sk] #10
                                                                          CometBroadcastExchange [d_date_sk] #14
                                                                            CometProject [d_date_sk]
                                                                              CometFilter [d_date_sk,d_year]
                                                                                CometScan 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]
                                        CometColumnarToRow
                                          InputAdapter
                                            CometColumnarExchange [c_customer_sk] #9
                                              WholeStageCodegen (2)
                                                HashAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum,isEmpty,sum,isEmpty]
                                                  CometColumnarToRow
                                                    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]
                                                              CometScan parquet spark_catalog.default.store_sales [ss_customer_sk,ss_quantity,ss_sales_price,ss_sold_date_sk]
                                                          CometBroadcastExchange [c_customer_sk] #10
                                                            CometFilter [c_customer_sk]
                                                              CometScan parquet spark_catalog.default.customer [c_customer_sk]
                          InputAdapter
                            BroadcastExchange #15
                              WholeStageCodegen (7)
                                SortMergeJoin [c_customer_sk,c_customer_sk]
                                  InputAdapter
                                    WholeStageCodegen (4)
                                      CometColumnarToRow
                                        InputAdapter
                                          CometSort [c_customer_sk,c_first_name,c_last_name]
                                            CometExchange [c_customer_sk] #16
                                              CometFilter [c_customer_sk,c_first_name,c_last_name]
                                                CometScan parquet 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] #3
                                            HashAggregate [c_customer_sk,sum,isEmpty] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                              CometColumnarToRow
                                                InputAdapter
                                                  ReusedExchange [c_customer_sk,sum,isEmpty] #9
                      InputAdapter
                        ReusedExchange [d_date_sk] #3
    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]
        CometColumnarToRow
          InputAdapter
            CometColumnarExchange [c_last_name,c_first_name] #17
              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)
                                CometColumnarToRow
                                  InputAdapter
                                    CometSort [ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                      CometExchange [ws_bill_customer_sk] #18
                                        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]
                                              CometScan parquet spark_catalog.default.web_sales [ws_item_sk,ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                                ReusedSubquery [d_date_sk] #1
                                            ReusedExchange [item_sk] #4
                            InputAdapter
                              WholeStageCodegen (13)
                                Sort [c_customer_sk]
                                  Project [c_customer_sk]
                                    Filter [ssales]
                                      ReusedSubquery [tpcds_cmax] #3
                                      HashAggregate [c_customer_sk,sum,isEmpty] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                        CometColumnarToRow
                                          InputAdapter
                                            ReusedExchange [c_customer_sk,sum,isEmpty] #9
                          InputAdapter
                            ReusedExchange [c_customer_sk,c_first_name,c_last_name] #15
                      InputAdapter
                        ReusedExchange [d_date_sk] #3
