TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,customer_preferred_cust_flag,customer_birth_country,customer_login,customer_email_address]
  WholeStageCodegen (53)
    Project [customer_id,customer_first_name,customer_last_name,customer_preferred_cust_flag,customer_birth_country,customer_login,customer_email_address]
      SortMergeJoin [customer_id,customer_id,year_total,year_total,year_total,year_total]
        InputAdapter
          WholeStageCodegen (44)
            Project [customer_id,customer_id,customer_first_name,customer_last_name,customer_preferred_cust_flag,customer_birth_country,customer_login,customer_email_address,year_total,year_total,year_total]
              SortMergeJoin [customer_id,customer_id]
                InputAdapter
                  WholeStageCodegen (35)
                    Project [customer_id,customer_id,customer_first_name,customer_last_name,customer_preferred_cust_flag,customer_birth_country,customer_login,customer_email_address,year_total,year_total]
                      SortMergeJoin [customer_id,customer_id,year_total,year_total,year_total,year_total]
                        InputAdapter
                          WholeStageCodegen (26)
                            Project [customer_id,year_total,customer_id,customer_first_name,customer_last_name,customer_preferred_cust_flag,customer_birth_country,customer_login,customer_email_address,year_total,year_total]
                              SortMergeJoin [customer_id,customer_id]
                                InputAdapter
                                  WholeStageCodegen (17)
                                    SortMergeJoin [customer_id,customer_id]
                                      InputAdapter
                                        WholeStageCodegen (8)
                                          Sort [customer_id]
                                            InputAdapter
                                              Exchange [customer_id] #1
                                                WholeStageCodegen (7)
                                                  Filter [year_total]
                                                    HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty]
                                                      InputAdapter
                                                        Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #2
                                                          WholeStageCodegen (6)
                                                            HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ss_ext_list_price,ss_ext_wholesale_cost,ss_ext_discount_amt,ss_ext_sales_price] [sum,isEmpty,sum,isEmpty]
                                                              Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ss_ext_discount_amt,ss_ext_sales_price,ss_ext_wholesale_cost,ss_ext_list_price,d_year]
                                                                SortMergeJoin [ss_customer_sk,c_customer_sk]
                                                                  InputAdapter
                                                                    WholeStageCodegen (3)
                                                                      Sort [ss_customer_sk]
                                                                        InputAdapter
                                                                          Exchange [ss_customer_sk] #3
                                                                            WholeStageCodegen (2)
                                                                              Project [ss_customer_sk,ss_ext_discount_amt,ss_ext_sales_price,ss_ext_wholesale_cost,ss_ext_list_price,d_year]
                                                                                BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                                  Filter [ss_customer_sk]
                                                                                    ColumnarToRow
                                                                                      InputAdapter
                                                                                        Scan parquet default.store_sales [ss_customer_sk,ss_ext_discount_amt,ss_ext_sales_price,ss_ext_wholesale_cost,ss_ext_list_price,ss_sold_date_sk]
                                                                                          SubqueryBroadcast [d_date_sk] #1
                                                                                            BroadcastExchange #4
                                                                                              WholeStageCodegen (1)
                                                                                                Filter [d_year,d_date_sk]
                                                                                                  ColumnarToRow
                                                                                                    InputAdapter
                                                                                                      Scan parquet default.date_dim [d_date_sk,d_year]
                                                                                  InputAdapter
                                                                                    ReusedExchange [d_date_sk,d_year] #4
                                                                  InputAdapter
                                                                    WholeStageCodegen (5)
                                                                      Sort [c_customer_sk]
                                                                        InputAdapter
                                                                          Exchange [c_customer_sk] #5
                                                                            WholeStageCodegen (4)
                                                                              Filter [c_customer_sk,c_customer_id]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address]
                                      InputAdapter
                                        WholeStageCodegen (16)
                                          Sort [customer_id]
                                            InputAdapter
                                              Exchange [customer_id] #6
                                                WholeStageCodegen (15)
                                                  HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,customer_first_name,customer_last_name,customer_preferred_cust_flag,customer_birth_country,customer_login,customer_email_address,year_total,sum,isEmpty]
                                                    InputAdapter
                                                      Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #7
                                                        WholeStageCodegen (14)
                                                          HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ss_ext_list_price,ss_ext_wholesale_cost,ss_ext_discount_amt,ss_ext_sales_price] [sum,isEmpty,sum,isEmpty]
                                                            Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ss_ext_discount_amt,ss_ext_sales_price,ss_ext_wholesale_cost,ss_ext_list_price,d_year]
                                                              SortMergeJoin [ss_customer_sk,c_customer_sk]
                                                                InputAdapter
                                                                  WholeStageCodegen (11)
                                                                    Sort [ss_customer_sk]
                                                                      InputAdapter
                                                                        Exchange [ss_customer_sk] #8
                                                                          WholeStageCodegen (10)
                                                                            Project [ss_customer_sk,ss_ext_discount_amt,ss_ext_sales_price,ss_ext_wholesale_cost,ss_ext_list_price,d_year]
                                                                              BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                                                                                Filter [ss_customer_sk]
                                                                                  ColumnarToRow
                                                                                    InputAdapter
                                                                                      Scan parquet default.store_sales [ss_customer_sk,ss_ext_discount_amt,ss_ext_sales_price,ss_ext_wholesale_cost,ss_ext_list_price,ss_sold_date_sk]
                                                                                        SubqueryBroadcast [d_date_sk] #2
                                                                                          BroadcastExchange #9
                                                                                            WholeStageCodegen (1)
                                                                                              Filter [d_year,d_date_sk]
                                                                                                ColumnarToRow
                                                                                                  InputAdapter
                                                                                                    Scan parquet default.date_dim [d_date_sk,d_year]
                                                                                InputAdapter
                                                                                  ReusedExchange [d_date_sk,d_year] #9
                                                                InputAdapter
                                                                  WholeStageCodegen (13)
                                                                    Sort [c_customer_sk]
                                                                      InputAdapter
                                                                        ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5
                                InputAdapter
                                  WholeStageCodegen (25)
                                    Sort [customer_id]
                                      InputAdapter
                                        Exchange [customer_id] #10
                                          WholeStageCodegen (24)
                                            Project [customer_id,year_total]
                                              Filter [year_total]
                                                HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty]
                                                  InputAdapter
                                                    Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11
                                                      WholeStageCodegen (23)
                                                        HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,cs_ext_list_price,cs_ext_wholesale_cost,cs_ext_discount_amt,cs_ext_sales_price] [sum,isEmpty,sum,isEmpty]
                                                          Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year]
                                                            SortMergeJoin [cs_bill_customer_sk,c_customer_sk]
                                                              InputAdapter
                                                                WholeStageCodegen (20)
                                                                  Sort [cs_bill_customer_sk]
                                                                    InputAdapter
                                                                      Exchange [cs_bill_customer_sk] #12
                                                                        WholeStageCodegen (19)
                                                                          Project [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year]
                                                                            BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                                              Filter [cs_bill_customer_sk]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet default.catalog_sales [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk]
                                                                                      ReusedSubquery [d_date_sk] #1
                                                                              InputAdapter
                                                                                ReusedExchange [d_date_sk,d_year] #4
                                                              InputAdapter
                                                                WholeStageCodegen (22)
                                                                  Sort [c_customer_sk]
                                                                    InputAdapter
                                                                      ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5
                        InputAdapter
                          WholeStageCodegen (34)
                            Sort [customer_id]
                              InputAdapter
                                Exchange [customer_id] #13
                                  WholeStageCodegen (33)
                                    HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty]
                                      InputAdapter
                                        Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #14
                                          WholeStageCodegen (32)
                                            HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,cs_ext_list_price,cs_ext_wholesale_cost,cs_ext_discount_amt,cs_ext_sales_price] [sum,isEmpty,sum,isEmpty]
                                              Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year]
                                                SortMergeJoin [cs_bill_customer_sk,c_customer_sk]
                                                  InputAdapter
                                                    WholeStageCodegen (29)
                                                      Sort [cs_bill_customer_sk]
                                                        InputAdapter
                                                          Exchange [cs_bill_customer_sk] #15
                                                            WholeStageCodegen (28)
                                                              Project [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year]
                                                                BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                                                                  Filter [cs_bill_customer_sk]
                                                                    ColumnarToRow
                                                                      InputAdapter
                                                                        Scan parquet default.catalog_sales [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk]
                                                                          ReusedSubquery [d_date_sk] #2
                                                                  InputAdapter
                                                                    ReusedExchange [d_date_sk,d_year] #9
                                                  InputAdapter
                                                    WholeStageCodegen (31)
                                                      Sort [c_customer_sk]
                                                        InputAdapter
                                                          ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5
                InputAdapter
                  WholeStageCodegen (43)
                    Sort [customer_id]
                      InputAdapter
                        Exchange [customer_id] #16
                          WholeStageCodegen (42)
                            Project [customer_id,year_total]
                              Filter [year_total]
                                HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty]
                                  InputAdapter
                                    Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #17
                                      WholeStageCodegen (41)
                                        HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_wholesale_cost,ws_ext_discount_amt,ws_ext_sales_price] [sum,isEmpty,sum,isEmpty]
                                          Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year]
                                            SortMergeJoin [ws_bill_customer_sk,c_customer_sk]
                                              InputAdapter
                                                WholeStageCodegen (38)
                                                  Sort [ws_bill_customer_sk]
                                                    InputAdapter
                                                      Exchange [ws_bill_customer_sk] #18
                                                        WholeStageCodegen (37)
                                                          Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year]
                                                            BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                              Filter [ws_bill_customer_sk]
                                                                ColumnarToRow
                                                                  InputAdapter
                                                                    Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk]
                                                                      ReusedSubquery [d_date_sk] #1
                                                              InputAdapter
                                                                ReusedExchange [d_date_sk,d_year] #4
                                              InputAdapter
                                                WholeStageCodegen (40)
                                                  Sort [c_customer_sk]
                                                    InputAdapter
                                                      ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5
        InputAdapter
          WholeStageCodegen (52)
            Sort [customer_id]
              InputAdapter
                Exchange [customer_id] #19
                  WholeStageCodegen (51)
                    HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty]
                      InputAdapter
                        Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #20
                          WholeStageCodegen (50)
                            HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_wholesale_cost,ws_ext_discount_amt,ws_ext_sales_price] [sum,isEmpty,sum,isEmpty]
                              Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year]
                                SortMergeJoin [ws_bill_customer_sk,c_customer_sk]
                                  InputAdapter
                                    WholeStageCodegen (47)
                                      Sort [ws_bill_customer_sk]
                                        InputAdapter
                                          Exchange [ws_bill_customer_sk] #21
                                            WholeStageCodegen (46)
                                              Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year]
                                                BroadcastHashJoin [ws_sold_date_sk,d_date_sk]
                                                  Filter [ws_bill_customer_sk]
                                                    ColumnarToRow
                                                      InputAdapter
                                                        Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk]
                                                          ReusedSubquery [d_date_sk] #2
                                                  InputAdapter
                                                    ReusedExchange [d_date_sk,d_year] #9
                                  InputAdapter
                                    WholeStageCodegen (49)
                                      Sort [c_customer_sk]
                                        InputAdapter
                                          ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5
