TakeOrderedAndProject [ca_country,ca_state,ca_county,i_item_id,agg1,agg2,agg3,agg4,agg5,agg6,agg7]
  Union
    WholeStageCodegen (8)
      HashAggregate [i_item_id,ca_country,ca_state,ca_county,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count] [avg(agg1),avg(agg2),avg(agg3),avg(agg4),avg(agg5),avg(agg6),avg(agg7),agg1,agg2,agg3,agg4,agg5,agg6,agg7,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
        InputAdapter
          Exchange [i_item_id,ca_country,ca_state,ca_county] #1
            WholeStageCodegen (7)
              HashAggregate [i_item_id,ca_country,ca_state,ca_county,agg1,agg2,agg3,agg4,agg5,agg6,agg7] [sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
                Project [i_item_id,ca_country,ca_state,ca_county,cs_quantity,cs_list_price,cs_coupon_amt,cs_sales_price,cs_net_profit,c_birth_year,cd_dep_count]
                  BroadcastHashJoin [cs_item_sk,i_item_sk]
                    Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cd_dep_count,c_birth_year,ca_county,ca_state,ca_country]
                      BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                        Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_birth_year,ca_county,ca_state,ca_country]
                          BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                            Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_addr_sk,c_birth_year]
                              BroadcastHashJoin [c_current_cdemo_sk,cd_demo_sk]
                                Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_cdemo_sk,c_current_addr_sk,c_birth_year]
                                  BroadcastHashJoin [cs_bill_customer_sk,c_customer_sk]
                                    Project [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count]
                                      BroadcastHashJoin [cs_bill_cdemo_sk,cd_demo_sk]
                                        Filter [cs_bill_cdemo_sk,cs_bill_customer_sk,cs_item_sk]
                                          ColumnarToRow
                                            InputAdapter
                                              Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_bill_cdemo_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk]
                                                SubqueryBroadcast [d_date_sk] #1
                                                  BroadcastExchange #2
                                                    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
                                          BroadcastExchange #3
                                            WholeStageCodegen (1)
                                              Project [cd_demo_sk,cd_dep_count]
                                                Filter [cd_gender,cd_education_status,cd_demo_sk]
                                                  ColumnarToRow
                                                    InputAdapter
                                                      Scan parquet spark_catalog.default.customer_demographics [cd_demo_sk,cd_gender,cd_education_status,cd_dep_count]
                                    InputAdapter
                                      BroadcastExchange #4
                                        WholeStageCodegen (2)
                                          Project [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk,c_birth_year]
                                            Filter [c_birth_month,c_customer_sk,c_current_cdemo_sk,c_current_addr_sk]
                                              ColumnarToRow
                                                InputAdapter
                                                  Scan parquet spark_catalog.default.customer [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk,c_birth_month,c_birth_year]
                                InputAdapter
                                  BroadcastExchange #5
                                    WholeStageCodegen (3)
                                      Filter [cd_demo_sk]
                                        ColumnarToRow
                                          InputAdapter
                                            Scan parquet spark_catalog.default.customer_demographics [cd_demo_sk]
                            InputAdapter
                              BroadcastExchange #6
                                WholeStageCodegen (4)
                                  Filter [ca_state,ca_address_sk]
                                    ColumnarToRow
                                      InputAdapter
                                        Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_county,ca_state,ca_country]
                        InputAdapter
                          ReusedExchange [d_date_sk] #2
                    InputAdapter
                      BroadcastExchange #7
                        WholeStageCodegen (6)
                          Filter [i_item_sk]
                            ColumnarToRow
                              InputAdapter
                                Scan parquet spark_catalog.default.item [i_item_sk,i_item_id]
    WholeStageCodegen (16)
      HashAggregate [i_item_id,ca_country,ca_state,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count] [avg(agg1),avg(agg2),avg(agg3),avg(agg4),avg(agg5),avg(agg6),avg(agg7),county,agg1,agg2,agg3,agg4,agg5,agg6,agg7,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
        InputAdapter
          Exchange [i_item_id,ca_country,ca_state] #8
            WholeStageCodegen (15)
              HashAggregate [i_item_id,ca_country,ca_state,agg1,agg2,agg3,agg4,agg5,agg6,agg7] [sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
                Project [i_item_id,ca_country,ca_state,cs_quantity,cs_list_price,cs_coupon_amt,cs_sales_price,cs_net_profit,c_birth_year,cd_dep_count]
                  BroadcastHashJoin [cs_item_sk,i_item_sk]
                    Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cd_dep_count,c_birth_year,ca_state,ca_country]
                      BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                        Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_birth_year,ca_state,ca_country]
                          BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                            Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_addr_sk,c_birth_year]
                              BroadcastHashJoin [c_current_cdemo_sk,cd_demo_sk]
                                Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_cdemo_sk,c_current_addr_sk,c_birth_year]
                                  BroadcastHashJoin [cs_bill_customer_sk,c_customer_sk]
                                    Project [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count]
                                      BroadcastHashJoin [cs_bill_cdemo_sk,cd_demo_sk]
                                        Filter [cs_bill_cdemo_sk,cs_bill_customer_sk,cs_item_sk]
                                          ColumnarToRow
                                            InputAdapter
                                              Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_bill_cdemo_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk]
                                                ReusedSubquery [d_date_sk] #1
                                        InputAdapter
                                          ReusedExchange [cd_demo_sk,cd_dep_count] #3
                                    InputAdapter
                                      ReusedExchange [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk,c_birth_year] #4
                                InputAdapter
                                  ReusedExchange [cd_demo_sk] #5
                            InputAdapter
                              BroadcastExchange #9
                                WholeStageCodegen (12)
                                  Filter [ca_state,ca_address_sk]
                                    ColumnarToRow
                                      InputAdapter
                                        Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_state,ca_country]
                        InputAdapter
                          ReusedExchange [d_date_sk] #2
                    InputAdapter
                      ReusedExchange [i_item_sk,i_item_id] #7
    WholeStageCodegen (24)
      HashAggregate [i_item_id,ca_country,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count] [avg(agg1),avg(agg2),avg(agg3),avg(agg4),avg(agg5),avg(agg6),avg(agg7),ca_state,county,agg1,agg2,agg3,agg4,agg5,agg6,agg7,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
        InputAdapter
          Exchange [i_item_id,ca_country] #10
            WholeStageCodegen (23)
              HashAggregate [i_item_id,ca_country,agg1,agg2,agg3,agg4,agg5,agg6,agg7] [sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
                Project [i_item_id,ca_country,cs_quantity,cs_list_price,cs_coupon_amt,cs_sales_price,cs_net_profit,c_birth_year,cd_dep_count]
                  BroadcastHashJoin [cs_item_sk,i_item_sk]
                    Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cd_dep_count,c_birth_year,ca_country]
                      BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                        Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_birth_year,ca_country]
                          BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                            Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_addr_sk,c_birth_year]
                              BroadcastHashJoin [c_current_cdemo_sk,cd_demo_sk]
                                Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_cdemo_sk,c_current_addr_sk,c_birth_year]
                                  BroadcastHashJoin [cs_bill_customer_sk,c_customer_sk]
                                    Project [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count]
                                      BroadcastHashJoin [cs_bill_cdemo_sk,cd_demo_sk]
                                        Filter [cs_bill_cdemo_sk,cs_bill_customer_sk,cs_item_sk]
                                          ColumnarToRow
                                            InputAdapter
                                              Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_bill_cdemo_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk]
                                                ReusedSubquery [d_date_sk] #1
                                        InputAdapter
                                          ReusedExchange [cd_demo_sk,cd_dep_count] #3
                                    InputAdapter
                                      ReusedExchange [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk,c_birth_year] #4
                                InputAdapter
                                  ReusedExchange [cd_demo_sk] #5
                            InputAdapter
                              BroadcastExchange #11
                                WholeStageCodegen (20)
                                  Project [ca_address_sk,ca_country]
                                    Filter [ca_state,ca_address_sk]
                                      ColumnarToRow
                                        InputAdapter
                                          Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_state,ca_country]
                        InputAdapter
                          ReusedExchange [d_date_sk] #2
                    InputAdapter
                      ReusedExchange [i_item_sk,i_item_id] #7
    WholeStageCodegen (32)
      HashAggregate [i_item_id,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count] [avg(agg1),avg(agg2),avg(agg3),avg(agg4),avg(agg5),avg(agg6),avg(agg7),ca_country,ca_state,county,agg1,agg2,agg3,agg4,agg5,agg6,agg7,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
        InputAdapter
          Exchange [i_item_id] #12
            WholeStageCodegen (31)
              HashAggregate [i_item_id,agg1,agg2,agg3,agg4,agg5,agg6,agg7] [sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
                Project [i_item_id,cs_quantity,cs_list_price,cs_coupon_amt,cs_sales_price,cs_net_profit,c_birth_year,cd_dep_count]
                  BroadcastHashJoin [cs_item_sk,i_item_sk]
                    Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cd_dep_count,c_birth_year]
                      BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                        Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_birth_year]
                          BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                            Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_addr_sk,c_birth_year]
                              BroadcastHashJoin [c_current_cdemo_sk,cd_demo_sk]
                                Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_cdemo_sk,c_current_addr_sk,c_birth_year]
                                  BroadcastHashJoin [cs_bill_customer_sk,c_customer_sk]
                                    Project [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count]
                                      BroadcastHashJoin [cs_bill_cdemo_sk,cd_demo_sk]
                                        Filter [cs_bill_cdemo_sk,cs_bill_customer_sk,cs_item_sk]
                                          ColumnarToRow
                                            InputAdapter
                                              Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_bill_cdemo_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk]
                                                ReusedSubquery [d_date_sk] #1
                                        InputAdapter
                                          ReusedExchange [cd_demo_sk,cd_dep_count] #3
                                    InputAdapter
                                      ReusedExchange [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk,c_birth_year] #4
                                InputAdapter
                                  ReusedExchange [cd_demo_sk] #5
                            InputAdapter
                              BroadcastExchange #13
                                WholeStageCodegen (28)
                                  Project [ca_address_sk]
                                    Filter [ca_state,ca_address_sk]
                                      ColumnarToRow
                                        InputAdapter
                                          Scan parquet spark_catalog.default.customer_address [ca_address_sk,ca_state]
                        InputAdapter
                          ReusedExchange [d_date_sk] #2
                    InputAdapter
                      ReusedExchange [i_item_sk,i_item_id] #7
    WholeStageCodegen (40)
      HashAggregate [sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count] [avg(agg1),avg(agg2),avg(agg3),avg(agg4),avg(agg5),avg(agg6),avg(agg7),i_item_id,ca_country,ca_state,county,agg1,agg2,agg3,agg4,agg5,agg6,agg7,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
        InputAdapter
          Exchange #14
            WholeStageCodegen (39)
              HashAggregate [agg1,agg2,agg3,agg4,agg5,agg6,agg7] [sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count,sum,count]
                Project [cs_quantity,cs_list_price,cs_coupon_amt,cs_sales_price,cs_net_profit,c_birth_year,cd_dep_count]
                  BroadcastHashJoin [cs_item_sk,i_item_sk]
                    Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cd_dep_count,c_birth_year]
                      BroadcastHashJoin [cs_sold_date_sk,d_date_sk]
                        Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_birth_year]
                          BroadcastHashJoin [c_current_addr_sk,ca_address_sk]
                            Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_addr_sk,c_birth_year]
                              BroadcastHashJoin [c_current_cdemo_sk,cd_demo_sk]
                                Project [cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count,c_current_cdemo_sk,c_current_addr_sk,c_birth_year]
                                  BroadcastHashJoin [cs_bill_customer_sk,c_customer_sk]
                                    Project [cs_bill_customer_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk,cd_dep_count]
                                      BroadcastHashJoin [cs_bill_cdemo_sk,cd_demo_sk]
                                        Filter [cs_bill_cdemo_sk,cs_bill_customer_sk,cs_item_sk]
                                          ColumnarToRow
                                            InputAdapter
                                              Scan parquet spark_catalog.default.catalog_sales [cs_bill_customer_sk,cs_bill_cdemo_sk,cs_item_sk,cs_quantity,cs_list_price,cs_sales_price,cs_coupon_amt,cs_net_profit,cs_sold_date_sk]
                                                ReusedSubquery [d_date_sk] #1
                                        InputAdapter
                                          ReusedExchange [cd_demo_sk,cd_dep_count] #3
                                    InputAdapter
                                      ReusedExchange [c_customer_sk,c_current_cdemo_sk,c_current_addr_sk,c_birth_year] #4
                                InputAdapter
                                  ReusedExchange [cd_demo_sk] #5
                            InputAdapter
                              ReusedExchange [ca_address_sk] #13
                        InputAdapter
                          ReusedExchange [d_date_sk] #2
                    InputAdapter
                      BroadcastExchange #15
                        WholeStageCodegen (38)
                          Filter [i_item_sk]
                            ColumnarToRow
                              InputAdapter
                                Scan parquet spark_catalog.default.item [i_item_sk]
