final aggregation over ()
    local exchange (GATHER, SINGLE, [])
        remote exchange (GATHER, SINGLE, [])
            partial aggregation over ()
                Filter
                    semijoin (PARTITIONED):
                        remote exchange (REPARTITION, HASH, ["cs_bill_customer_sk"])
                            Filter
                                semijoin (PARTITIONED):
                                    remote exchange (REPARTITION, HASH, ["cs_item_sk"])
                                        join (INNER, REPLICATED):
                                            Filter
                                                scan catalog_sales
                                            local exchange (GATHER, SINGLE, [])
                                                remote exchange (REPLICATE, BROADCAST, [])
                                                    Filter
                                                        scan date_dim
                                    local exchange (GATHER, SINGLE, [])
                                        remote exchange (REPARTITION, HASH, ["ss_item_sk"])
                                            remote exchange (REPARTITION, HASH, ["count_31", "d_date_3", "ss_item_sk", "substr"])
                                                cte frequent_ss_items
                                                    Filter
                                                        final aggregation over (d_date_3, ss_item_sk, substr)
                                                            local exchange (GATHER, SINGLE, [])
                                                                remote exchange (REPARTITION, HASH, ["d_date_3", "ss_item_sk", "substr"])
                                                                    partial aggregation over (d_date_3, ss_item_sk, substr)
                                                                        join (INNER, REPLICATED):
                                                                            join (INNER, REPLICATED):
                                                                                Filter
                                                                                    scan store_sales
                                                                                local exchange (GATHER, SINGLE, [])
                                                                                    remote exchange (REPLICATE, BROADCAST, [])
                                                                                        Filter
                                                                                            scan date_dim
                                                                            local exchange (GATHER, SINGLE, [])
                                                                                remote exchange (REPLICATE, BROADCAST, [])
                                                                                    scan item
                        local exchange (GATHER, SINGLE, [])
                            remote exchange (REPARTITION, HASH, ["ss_customer_sk_60"])
                                remote exchange (REPARTITION, HASH, ["ss_customer_sk_60", "sum"])
                                    cte best_ss_customer
                                        Filter
                                            cross join:
                                                final aggregation over (ss_customer_sk_60)
                                                    local exchange (GATHER, SINGLE, [])
                                                        partial aggregation over (ss_customer_sk_60)
                                                            join (INNER, PARTITIONED):
                                                                remote exchange (REPARTITION, HASH, ["ss_customer_sk_60"])
                                                                    scan store_sales
                                                                local exchange (GATHER, SINGLE, [])
                                                                    remote exchange (REPARTITION, HASH, ["c_customer_sk"])
                                                                        scan customer
                                                local exchange (GATHER, SINGLE, [])
                                                    remote exchange (REPLICATE, BROADCAST, [])
                                                        local exchange (GATHER, SINGLE, [])
                                                            remote exchange (GATHER, SINGLE, [])
                                                                cte max_store_sales
                                                                    final aggregation over ()
                                                                        local exchange (GATHER, SINGLE, [])
                                                                            remote exchange (GATHER, SINGLE, [])
                                                                                partial aggregation over ()
                                                                                    final aggregation over (ss_customer_sk_90)
                                                                                        local exchange (GATHER, SINGLE, [])
                                                                                            partial aggregation over (ss_customer_sk_90)
                                                                                                join (INNER, REPLICATED):
                                                                                                    join (INNER, PARTITIONED):
                                                                                                        remote exchange (REPARTITION, HASH, ["ss_customer_sk_90"])
                                                                                                            Filter
                                                                                                                scan store_sales
                                                                                                        local exchange (GATHER, SINGLE, [])
                                                                                                            remote exchange (REPARTITION, HASH, ["c_customer_sk_110"])
                                                                                                                scan customer
                                                                                                    local exchange (GATHER, SINGLE, [])
                                                                                                        remote exchange (REPLICATE, BROADCAST, [])
                                                                                                            Filter
                                                                                                                scan date_dim
            partial aggregation over ()
                Filter
                    semijoin (PARTITIONED):
                        remote exchange (REPARTITION, HASH, ["ws_bill_customer_sk"])
                            Filter
                                semijoin (PARTITIONED):
                                    remote exchange (REPARTITION, HASH, ["ws_item_sk"])
                                        join (INNER, REPLICATED):
                                            Filter
                                                scan web_sales
                                            local exchange (GATHER, SINGLE, [])
                                                remote exchange (REPLICATE, BROADCAST, [])
                                                    Filter
                                                        scan date_dim
                                    local exchange (GATHER, SINGLE, [])
                                        remote exchange (REPARTITION, HASH, ["ss_item_sk_226"])
                                            remote exchange (REPARTITION, HASH, ["count_304", "d_date_249", "ss_item_sk_226", "substr_297"])
                                                cte frequent_ss_items
                                                    Filter
                                                        final aggregation over (d_date_249, ss_item_sk_226, substr_297)
                                                            local exchange (GATHER, SINGLE, [])
                                                                remote exchange (REPARTITION, HASH, ["d_date_249", "ss_item_sk_226", "substr_297"])
                                                                    partial aggregation over (d_date_249, ss_item_sk_226, substr_297)
                                                                        join (INNER, REPLICATED):
                                                                            join (INNER, REPLICATED):
                                                                                Filter
                                                                                    scan store_sales
                                                                                local exchange (GATHER, SINGLE, [])
                                                                                    remote exchange (REPLICATE, BROADCAST, [])
                                                                                        Filter
                                                                                            scan date_dim
                                                                            local exchange (GATHER, SINGLE, [])
                                                                                remote exchange (REPLICATE, BROADCAST, [])
                                                                                    scan item
                        local exchange (GATHER, SINGLE, [])
                            remote exchange (REPARTITION, HASH, ["ss_customer_sk_335"])
                                remote exchange (REPARTITION, HASH, ["ss_customer_sk_335", "sum_377"])
                                    cte best_ss_customer
                                        Filter
                                            cross join:
                                                final aggregation over (ss_customer_sk_335)
                                                    local exchange (GATHER, SINGLE, [])
                                                        partial aggregation over (ss_customer_sk_335)
                                                            join (INNER, PARTITIONED):
                                                                remote exchange (REPARTITION, HASH, ["ss_customer_sk_335"])
                                                                    scan store_sales
                                                                local exchange (GATHER, SINGLE, [])
                                                                    remote exchange (REPARTITION, HASH, ["c_customer_sk_355"])
                                                                        scan customer
                                                local exchange (GATHER, SINGLE, [])
                                                    remote exchange (REPLICATE, BROADCAST, [])
                                                        local exchange (GATHER, SINGLE, [])
                                                            remote exchange (GATHER, SINGLE, [])
                                                                cte max_store_sales
                                                                    final aggregation over ()
                                                                        local exchange (GATHER, SINGLE, [])
                                                                            remote exchange (GATHER, SINGLE, [])
                                                                                partial aggregation over ()
                                                                                    final aggregation over (ss_customer_sk_385)
                                                                                        local exchange (GATHER, SINGLE, [])
                                                                                            partial aggregation over (ss_customer_sk_385)
                                                                                                join (INNER, REPLICATED):
                                                                                                    join (INNER, PARTITIONED):
                                                                                                        remote exchange (REPARTITION, HASH, ["ss_customer_sk_385"])
                                                                                                            Filter
                                                                                                                scan store_sales
                                                                                                        local exchange (GATHER, SINGLE, [])
                                                                                                            remote exchange (REPARTITION, HASH, ["c_customer_sk_405"])
                                                                                                                scan customer
                                                                                                    local exchange (GATHER, SINGLE, [])
                                                                                                        remote exchange (REPLICATE, BROADCAST, [])
                                                                                                            Filter
                                                                                                                scan date_dim
