From 03f7bd119240be8bd50c500b116bee4106cd992d Mon Sep 17 00:00:00 2001 From: Igor Nikonov Date: Wed, 14 Dec 2022 13:54:42 +0000 Subject: [PATCH] Fix for distributed queries --- .../QueryPlan/Optimizations/QueryPlanOptimizationSettings.cpp | 2 +- .../QueryPlan/Optimizations/removeRedundantDistinct.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Processors/QueryPlan/Optimizations/QueryPlanOptimizationSettings.cpp b/src/Processors/QueryPlan/Optimizations/QueryPlanOptimizationSettings.cpp index 92dca42c347..37a3fcf584a 100644 --- a/src/Processors/QueryPlan/Optimizations/QueryPlanOptimizationSettings.cpp +++ b/src/Processors/QueryPlan/Optimizations/QueryPlanOptimizationSettings.cpp @@ -14,7 +14,7 @@ QueryPlanOptimizationSettings QueryPlanOptimizationSettings::fromSettings(const settings.distinct_in_order = from.optimize_distinct_in_order; settings.read_in_order = from.optimize_read_in_order && from.query_plan_read_in_order; settings.aggregation_in_order = from.optimize_aggregation_in_order && from.query_plan_aggregation_in_order; - settings.remove_redundant_distinct = from.query_plan_remove_redundant_distinct; + settings.remove_redundant_distinct = from.query_plan_remove_redundant_distinct && !from.distributed_group_by_no_merge; return settings; } diff --git a/src/Processors/QueryPlan/Optimizations/removeRedundantDistinct.cpp b/src/Processors/QueryPlan/Optimizations/removeRedundantDistinct.cpp index 79d08c64543..5976d8238e0 100644 --- a/src/Processors/QueryPlan/Optimizations/removeRedundantDistinct.cpp +++ b/src/Processors/QueryPlan/Optimizations/removeRedundantDistinct.cpp @@ -51,7 +51,6 @@ size_t tryRemoveRedundantDistinct(QueryPlan::Node * parent_node, QueryPlan::Node return 0; chassert(!distinct_node->children.empty()); - chassert(typeid_cast(distinct_node->children.front()->step.get())); /// delete current distinct parent_node->children[0] = distinct_node->children.front();