TakeOrderedAndProject [c_last_name,c_first_name,sales]
  Union
    WholeStageCodegen (27)
      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 (26)
              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]
                  SortMergeJoin [cs_bill_customer_sk,c_customer_sk]
                    InputAdapter
                      WholeStageCodegen (17)
                        Project [cs_bill_customer_sk,cs_quantity,cs_list_price]
                          BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                            SortMergeJoin [cs_bill_customer_sk,c_customer_sk]
                              InputAdapter
                                WholeStageCodegen (10)
                                  Sort [cs_bill_customer_sk]
                                    InputAdapter
                                      Exchange [cs_bill_customer_sk] #2
                                        WholeStageCodegen (9)
                                          Project [cs_bill_customer_sk,cs_quantity,cs_list_price,cs_sold_date_sk]
                                            SortMergeJoin [cs_item_sk,item_sk]
                                              InputAdapter
                                                WholeStageCodegen (2)
                                                  Sort [cs_item_sk]
                                                    InputAdapter
                                                      Exchange [cs_item_sk] #3
                                                        WholeStageCodegen (1)
                                                          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]
                                                                  SubqueryBroadcast [d_date_sk] #1
                                                                    BroadcastExchange #4
                                                                      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
                                                WholeStageCodegen (8)
                                                  Sort [item_sk]
                                                    Project [item_sk]
                                                      Filter [cnt]
                                                        HashAggregate [_groupingexpression,i_item_sk,d_date] [count(1),item_sk,cnt,count]
                                                          Project [d_date,i_item_sk,i_item_desc]
                                                            SortMergeJoin [ss_item_sk,i_item_sk]
                                                              InputAdapter
                                                                WholeStageCodegen (5)
                                                                  Sort [ss_item_sk]
                                                                    InputAdapter
                                                                      Exchange [ss_item_sk] #5
                                                                        WholeStageCodegen (4)
                                                                          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]
                                                                                      SubqueryBroadcast [d_date_sk] #2
                                                                                        BroadcastExchange #6
                                                                                          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
                                                                                ReusedExchange [d_date_sk,d_date] #6
                                                              InputAdapter
                                                                WholeStageCodegen (7)
                                                                  Sort [i_item_sk]
                                                                    InputAdapter
                                                                      Exchange [i_item_sk] #7
                                                                        WholeStageCodegen (6)
                                                                          Filter [i_item_sk]
                                                                            ColumnarToRow
                                                                              InputAdapter
                                                                                Scan parquet spark_catalog.default.item [i_item_sk,i_item_desc]
                              InputAdapter
                                WholeStageCodegen (15)
                                  Project [c_customer_sk]
                                    Filter [ssales]
                                      Subquery #3
                                        WholeStageCodegen (7)
                                          HashAggregate [max] [max(csales),tpcds_cmax,max]
                                            InputAdapter
                                              Exchange #10
                                                WholeStageCodegen (6)
                                                  HashAggregate [csales] [max,max]
                                                    SortAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),csales,sum,isEmpty]
                                                      Project [ss_quantity,ss_sales_price,c_customer_sk]
                                                        SortMergeJoin [ss_customer_sk,c_customer_sk]
                                                          InputAdapter
                                                            WholeStageCodegen (3)
                                                              Sort [ss_customer_sk]
                                                                InputAdapter
                                                                  Exchange [ss_customer_sk] #11
                                                                    WholeStageCodegen (2)
                                                                      Project [ss_customer_sk,ss_quantity,ss_sales_price]
                                                                        BroadcastHashJoin [ss_sold_date_sk,d_date_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]
                                                                                  SubqueryBroadcast [d_date_sk] #4
                                                                                    BroadcastExchange #12
                                                                                      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] #12
                                                          InputAdapter
                                                            WholeStageCodegen (5)
                                                              Sort [c_customer_sk]
                                                                InputAdapter
                                                                  ReusedExchange [c_customer_sk] #9
                                      SortAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                        Project [ss_quantity,ss_sales_price,c_customer_sk]
                                          SortMergeJoin [ss_customer_sk,c_customer_sk]
                                            InputAdapter
                                              WholeStageCodegen (12)
                                                Sort [ss_customer_sk]
                                                  InputAdapter
                                                    Exchange [ss_customer_sk] #8
                                                      WholeStageCodegen (11)
                                                        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
                                              WholeStageCodegen (14)
                                                Sort [c_customer_sk]
                                                  InputAdapter
                                                    Exchange [c_customer_sk] #9
                                                      WholeStageCodegen (13)
                                                        Filter [c_customer_sk]
                                                          ColumnarToRow
                                                            InputAdapter
                                                              Scan parquet spark_catalog.default.customer [c_customer_sk]
                            InputAdapter
                              ReusedExchange [d_date_sk] #4
                    InputAdapter
                      WholeStageCodegen (25)
                        SortMergeJoin [c_customer_sk,c_customer_sk]
                          InputAdapter
                            WholeStageCodegen (19)
                              Sort [c_customer_sk]
                                InputAdapter
                                  Exchange [c_customer_sk] #13
                                    WholeStageCodegen (18)
                                      Filter [c_customer_sk]
                                        ColumnarToRow
                                          InputAdapter
                                            Scan parquet spark_catalog.default.customer [c_customer_sk,c_first_name,c_last_name]
                          InputAdapter
                            WholeStageCodegen (24)
                              Project [c_customer_sk]
                                Filter [ssales]
                                  ReusedSubquery [tpcds_cmax] #3
                                  SortAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                    Project [ss_quantity,ss_sales_price,c_customer_sk]
                                      SortMergeJoin [ss_customer_sk,c_customer_sk]
                                        InputAdapter
                                          WholeStageCodegen (21)
                                            Sort [ss_customer_sk]
                                              InputAdapter
                                                ReusedExchange [ss_customer_sk,ss_quantity,ss_sales_price] #8
                                        InputAdapter
                                          WholeStageCodegen (23)
                                            Sort [c_customer_sk]
                                              InputAdapter
                                                ReusedExchange [c_customer_sk] #9
    WholeStageCodegen (54)
      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] #14
            WholeStageCodegen (53)
              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]
                  SortMergeJoin [ws_bill_customer_sk,c_customer_sk]
                    InputAdapter
                      WholeStageCodegen (44)
                        Project [ws_bill_customer_sk,ws_quantity,ws_list_price]
                          BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                            SortMergeJoin [ws_bill_customer_sk,c_customer_sk]
                              InputAdapter
                                WholeStageCodegen (37)
                                  Sort [ws_bill_customer_sk]
                                    InputAdapter
                                      Exchange [ws_bill_customer_sk] #15
                                        WholeStageCodegen (36)
                                          Project [ws_bill_customer_sk,ws_quantity,ws_list_price,ws_sold_date_sk]
                                            SortMergeJoin [ws_item_sk,item_sk]
                                              InputAdapter
                                                WholeStageCodegen (29)
                                                  Sort [ws_item_sk]
                                                    InputAdapter
                                                      Exchange [ws_item_sk] #16
                                                        WholeStageCodegen (28)
                                                          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]
                                                                  ReusedSubquery [d_date_sk] #1
                                              InputAdapter
                                                WholeStageCodegen (35)
                                                  Sort [item_sk]
                                                    Project [item_sk]
                                                      Filter [cnt]
                                                        HashAggregate [_groupingexpression,i_item_sk,d_date] [count(1),item_sk,cnt,count]
                                                          Project [d_date,i_item_sk,i_item_desc]
                                                            SortMergeJoin [ss_item_sk,i_item_sk]
                                                              InputAdapter
                                                                WholeStageCodegen (32)
                                                                  Sort [ss_item_sk]
                                                                    InputAdapter
                                                                      ReusedExchange [ss_item_sk,d_date] #5
                                                              InputAdapter
                                                                WholeStageCodegen (34)
                                                                  Sort [i_item_sk]
                                                                    InputAdapter
                                                                      ReusedExchange [i_item_sk,i_item_desc] #7
                              InputAdapter
                                WholeStageCodegen (42)
                                  Project [c_customer_sk]
                                    Filter [ssales]
                                      ReusedSubquery [tpcds_cmax] #3
                                      SortAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                        Project [ss_quantity,ss_sales_price,c_customer_sk]
                                          SortMergeJoin [ss_customer_sk,c_customer_sk]
                                            InputAdapter
                                              WholeStageCodegen (39)
                                                Sort [ss_customer_sk]
                                                  InputAdapter
                                                    ReusedExchange [ss_customer_sk,ss_quantity,ss_sales_price] #8
                                            InputAdapter
                                              WholeStageCodegen (41)
                                                Sort [c_customer_sk]
                                                  InputAdapter
                                                    ReusedExchange [c_customer_sk] #9
                            InputAdapter
                              ReusedExchange [d_date_sk] #4
                    InputAdapter
                      WholeStageCodegen (52)
                        SortMergeJoin [c_customer_sk,c_customer_sk]
                          InputAdapter
                            WholeStageCodegen (46)
                              Sort [c_customer_sk]
                                InputAdapter
                                  ReusedExchange [c_customer_sk,c_first_name,c_last_name] #13
                          InputAdapter
                            WholeStageCodegen (51)
                              Project [c_customer_sk]
                                Filter [ssales]
                                  ReusedSubquery [tpcds_cmax] #3
                                  SortAggregate [c_customer_sk,ss_quantity,ss_sales_price] [sum((cast(ss_quantity as decimal(10,0)) * ss_sales_price)),ssales,sum,isEmpty]
                                    Project [ss_quantity,ss_sales_price,c_customer_sk]
                                      SortMergeJoin [ss_customer_sk,c_customer_sk]
                                        InputAdapter
                                          WholeStageCodegen (48)
                                            Sort [ss_customer_sk]
                                              InputAdapter
                                                ReusedExchange [ss_customer_sk,ss_quantity,ss_sales_price] #8
                                        InputAdapter
                                          WholeStageCodegen (50)
                                            Sort [c_customer_sk]
                                              InputAdapter
                                                ReusedExchange [c_customer_sk] #9
