TakeOrderedAndProject [segment,num_customers,segment_base]
  WholeStageCodegen (16)
    HashAggregate [segment,count] [count(1),num_customers,segment_base,count]
      InputAdapter
        Exchange [segment] #1
          WholeStageCodegen (15)
            HashAggregate [segment] [count,count]
              HashAggregate [c_customer_sk,sum] [sum(UnscaledValue(ss_ext_sales_price)),segment,sum]
                HashAggregate [c_customer_sk,ss_ext_sales_price] [sum,sum]
                  Project [c_customer_sk,ss_ext_sales_price]
                    SortMergeJoin [c_customer_sk,ss_customer_sk]
                      InputAdapter
                        WholeStageCodegen (11)
                          Sort [c_customer_sk]
                            Project [c_customer_sk]
                              BroadcastHashJoin [ca_address_sk,c_current_addr_sk]
                                InputAdapter
                                  BroadcastExchange #2
                                    WholeStageCodegen (2)
                                      Project [ca_address_sk]
                                        BroadcastHashJoin [ca_county,ca_state,s_county,s_state]
                                          Filter [ca_address_sk,ca_county,ca_state]
                                            ColumnarToRow
                                              InputAdapter
                                                Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_county,ca_state]
                                          InputAdapter
                                            BroadcastExchange #3
                                              WholeStageCodegen (1)
                                                Filter [s_county,s_state]
                                                  ColumnarToRow
                                                    InputAdapter
                                                      Scan parquet spark_catalog.default.store [s_county,s_state]
                                HashAggregate [c_customer_sk,c_current_addr_sk]
                                  HashAggregate [c_customer_sk,c_current_addr_sk]
                                    Project [c_customer_sk,c_current_addr_sk]
                                      SortMergeJoin [customer_sk,c_customer_sk]
                                        InputAdapter
                                          WholeStageCodegen (8)
                                            Sort [customer_sk]
                                              InputAdapter
                                                Exchange [customer_sk] #4
                                                  WholeStageCodegen (7)
                                                    Project [customer_sk]
                                                      BroadcastHashJoin [item_sk,i_item_sk]
                                                        Project [customer_sk,item_sk]
                                                          BroadcastHashJoin [sold_date_sk,d_date_sk]
                                                            InputAdapter
                                                              Union
                                                                WholeStageCodegen (3)
                                                                  Project [cs_sold_date_sk,cs_bill_customer_sk,cs_item_sk]
                                                                    Filter [cs_item_sk,cs_bill_customer_sk]
                                                                      ColumnarToRow
                                                                        InputAdapter
                                                                          Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_item_sk,cs_sold_date_sk]
                                                                            SubqueryBroadcast [d_date_sk] #1
                                                                              BroadcastExchange #5
                                                                                WholeStageCodegen (1)
                                                                                  Project [d_date_sk]
                                                                                    Filter [d_moy,d_year,d_date_sk]
                                                                                      ColumnarToRow
                                                                                        InputAdapter
                                                                                          Scan parquet spark_catalog.default.date_dim [d_date_sk,d_year,d_moy]
                                                                WholeStageCodegen (4)
                                                                  Project [ws_sold_date_sk,ws_bill_customer_sk,ws_item_sk]
                                                                    Filter [ws_item_sk,ws_bill_customer_sk]
                                                                      ColumnarToRow
                                                                        InputAdapter
                                                                          Scan parquet spark_catalog.default.web_sales [ws_item_sk,ws_bill_customer_sk,ws_sold_date_sk]
                                                                            ReusedSubquery [d_date_sk] #1
                                                            InputAdapter
                                                              ReusedExchange [d_date_sk] #5
                                                        InputAdapter
                                                          BroadcastExchange #6
                                                            WholeStageCodegen (6)
                                                              Project [i_item_sk]
                                                                Filter [i_category,i_class,i_item_sk]
                                                                  ColumnarToRow
                                                                    InputAdapter
                                                                      Scan parquet spark_catalog.default.item [i_item_sk,i_class,i_category]
                                        InputAdapter
                                          WholeStageCodegen (10)
                                            Sort [c_customer_sk]
                                              InputAdapter
                                                Exchange [c_customer_sk] #7
                                                  WholeStageCodegen (9)
                                                    Filter [c_customer_sk,c_current_addr_sk]
                                                      ColumnarToRow
                                                        InputAdapter
                                                          Scan parquet spark_catalog.default.customer [c_customer_sk,c_current_addr_sk]
                      InputAdapter
                        WholeStageCodegen (14)
                          Sort [ss_customer_sk]
                            InputAdapter
                              Exchange [ss_customer_sk] #8
                                WholeStageCodegen (13)
                                  Project [ss_customer_sk,ss_ext_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_ext_sales_price,ss_sold_date_sk]
                                              SubqueryBroadcast [d_date_sk] #2
                                                BroadcastExchange #9
                                                  WholeStageCodegen (1)
                                                    Project [d_date_sk]
                                                      Filter [d_month_seq,d_date_sk]
                                                        ReusedSubquery [(d_month_seq + 1)] #3
                                                        ReusedSubquery [(d_month_seq + 3)] #4
                                                        ColumnarToRow
                                                          InputAdapter
                                                            Scan parquet spark_catalog.default.date_dim [d_date_sk,d_month_seq]
                                                              Subquery #3
                                                                WholeStageCodegen (2)
                                                                  HashAggregate [(d_month_seq + 1)]
                                                                    InputAdapter
                                                                      Exchange [(d_month_seq + 1)] #10
                                                                        WholeStageCodegen (1)
                                                                          HashAggregate [(d_month_seq + 1)]
                                                                            Project [d_month_seq]
                                                                              Filter [d_year,d_moy]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet spark_catalog.default.date_dim [d_month_seq,d_year,d_moy]
                                                              Subquery #4
                                                                WholeStageCodegen (2)
                                                                  HashAggregate [(d_month_seq + 3)]
                                                                    InputAdapter
                                                                      Exchange [(d_month_seq + 3)] #11
                                                                        WholeStageCodegen (1)
                                                                          HashAggregate [(d_month_seq + 3)]
                                                                            Project [d_month_seq]
                                                                              Filter [d_year,d_moy]
                                                                                ColumnarToRow
                                                                                  InputAdapter
                                                                                    Scan parquet spark_catalog.default.date_dim [d_month_seq,d_year,d_moy]
                                      InputAdapter
                                        ReusedExchange [d_date_sk] #9
