TakeOrderedAndProject [segment,num_customers,segment_base]
  WholeStageCodegen (13)
    HashAggregate [segment,count] [count(1),num_customers,segment_base,count]
      InputAdapter
        Exchange [segment] #1
          WholeStageCodegen (12)
            HashAggregate [segment] [count,count]
              HashAggregate [c_customer_sk,sum] [sum(UnscaledValue(ss_ext_sales_price)),segment,sum]
                InputAdapter
                  Exchange [c_customer_sk] #2
                    WholeStageCodegen (11)
                      HashAggregate [c_customer_sk,ss_ext_sales_price] [sum,sum]
                        Project [c_customer_sk,ss_ext_sales_price]
                          BroadcastHashJoin [ss_sold_date_sk,d_date_sk]
                            Project [c_customer_sk,ss_ext_sales_price,ss_sold_date_sk]
                              BroadcastHashJoin [ca_county,ca_state,s_county,s_state]
                                Project [c_customer_sk,ss_ext_sales_price,ss_sold_date_sk,ca_county,ca_state]
                                  BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                                    Project [c_customer_sk,c_current_addr_sk,ss_ext_sales_price,ss_sold_date_sk]
                                      BroadcastHashJoin [c_customer_sk,ss_customer_sk]
                                        HashAggregate [c_customer_sk,c_current_addr_sk]
                                          InputAdapter
                                            Exchange [c_customer_sk,c_current_addr_sk] #3
                                              WholeStageCodegen (6)
                                                HashAggregate [c_customer_sk,c_current_addr_sk]
                                                  Project [c_customer_sk,c_current_addr_sk]
                                                    BroadcastHashJoin [customer_sk,c_customer_sk]
                                                      Project [customer_sk]
                                                        BroadcastHashJoin [sold_date_sk,d_date_sk]
                                                          Project [sold_date_sk,customer_sk]
                                                            BroadcastHashJoin [item_sk,i_item_sk]
                                                              InputAdapter
                                                                Union
                                                                  WholeStageCodegen (1)
                                                                    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 #4
                                                                                  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 (2)
                                                                    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
                                                                BroadcastExchange #5
                                                                  WholeStageCodegen (3)
                                                                    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
                                                            ReusedExchange [d_date_sk] #4
                                                      InputAdapter
                                                        BroadcastExchange #6
                                                          WholeStageCodegen (5)
                                                            Filter [c_customer_sk,c_current_addr_sk]
                                                              ColumnarToRow
                                                                InputAdapter
                                                                  Scan parquet spark_catalog.default.customer [c_customer_sk,c_current_addr_sk]
                                        InputAdapter
                                          BroadcastExchange #7
                                            WholeStageCodegen (7)
                                              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 #8
                                                          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)] #9
                                                                                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)] #10
                                                                                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
                                      BroadcastExchange #11
                                        WholeStageCodegen (8)
                                          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 #12
                                    WholeStageCodegen (9)
                                      Filter [s_county,s_state]
                                        ColumnarToRow
                                          InputAdapter
                                            Scan parquet spark_catalog.default.store [s_county,s_state]
                            InputAdapter
                              ReusedExchange [d_date_sk] #8
