From ad9fa14aab00dba4a87713d693a3f6d92fbb9547 Mon Sep 17 00:00:00 2001 From: leiysky Date: Wed, 24 Aug 2022 00:38:06 +0800 Subject: [PATCH] fix test --- src/query/service/src/sql/optimizer/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/query/service/src/sql/optimizer/mod.rs b/src/query/service/src/sql/optimizer/mod.rs index 17a47ac3776a1..60c104ccd8fb1 100644 --- a/src/query/service/src/sql/optimizer/mod.rs +++ b/src/query/service/src/sql/optimizer/mod.rs @@ -136,6 +136,8 @@ pub fn optimize_query( ) -> Result { let rules = RuleList::create(DEFAULT_REWRITE_RULES.clone())?; + let contains_local_table_scan = contains_local_table_scan(&s_expr, &metadata); + let mut heuristic = HeuristicOptimizer::new(ctx, bind_context, metadata.clone(), rules); let mut result = heuristic.optimize(s_expr)?; @@ -144,8 +146,8 @@ pub fn optimize_query( // So far, we don't have ability to execute distributed query // with reading data from local tales(e.g. system tables). - let enable_distributed_query = opt_ctx.config.enable_distributed_optimization - && !contains_local_table_scan(&s_expr, &metadata); + let enable_distributed_query = + opt_ctx.config.enable_distributed_optimization && !contains_local_table_scan; if enable_distributed_query && validate_distributed_query(&result) { result = optimize_distributed_query(&result)?; }