From dbfa34c288add659fdda03d0858bce9dbb619a13 Mon Sep 17 00:00:00 2001 From: dantengsky Date: Tue, 28 May 2024 17:42:12 +0800 Subject: [PATCH] adjust logic tests --- scripts/ci/deploy/config/databend-query-node-1.toml | 2 +- .../src/pipelines/builders/merge_into_join_optimizations.rs | 3 +++ src/query/sql/src/planner/optimizer/optimizer.rs | 4 ++++ .../explain/09_0039_target_build_merge_into_standalone.test | 4 ++-- .../suites/mode/standalone/explain/merge_into.test | 4 ++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/ci/deploy/config/databend-query-node-1.toml b/scripts/ci/deploy/config/databend-query-node-1.toml index 702bef42324b6..1ba43c61df10d 100644 --- a/scripts/ci/deploy/config/databend-query-node-1.toml +++ b/scripts/ci/deploy/config/databend-query-node-1.toml @@ -73,7 +73,7 @@ join_spilling_memory_ratio = 60 [log] [log.file] -level = "INFO" +level = "DEBUG" format = "text" dir = "./.databend/logs_1" prefix_filter = "" diff --git a/src/query/service/src/pipelines/builders/merge_into_join_optimizations.rs b/src/query/service/src/pipelines/builders/merge_into_join_optimizations.rs index ea505a0383136..f92646e61479c 100644 --- a/src/query/service/src/pipelines/builders/merge_into_join_optimizations.rs +++ b/src/query/service/src/pipelines/builders/merge_into_join_optimizations.rs @@ -25,6 +25,9 @@ impl PipelineBuilder { PhysicalPlan::TableScan(scan) => match scan.table_index { None | Some(databend_common_sql::DUMMY_TABLE_INDEX) => (false, false), Some(table_index) => match need_reserve_block_info(self.ctx.clone(), table_index) { + // due to issue https://github.com/datafuselabs/databend/issues/15643, + // target build optimization of merge-into is disabled + //(true, is_distributed) => (true, is_distributed), (true, is_distributed) => (false, is_distributed), _ => (false, false), diff --git a/src/query/sql/src/planner/optimizer/optimizer.rs b/src/query/sql/src/planner/optimizer/optimizer.rs index d04d833ee8fe1..76c6b9bd3c904 100644 --- a/src/query/sql/src/planner/optimizer/optimizer.rs +++ b/src/query/sql/src/planner/optimizer/optimizer.rs @@ -494,6 +494,10 @@ async fn optimize_merge_into(opt_ctx: OptimizerContext, plan: Box) -> == 0 && flag { + // due to issue https://github.com/datafuselabs/databend/issues/15643, + // target build optimization of merge-into is disabled: here row_id column should be kept + + // new_columns_set.remove(&plan.row_id_index); opt_ctx.table_ctx.set_merge_into_join(MergeIntoJoin { merge_into_join_type: MergeIntoJoinType::Left, is_distributed: false, diff --git a/tests/sqllogictests/suites/mode/standalone/explain/09_0039_target_build_merge_into_standalone.test b/tests/sqllogictests/suites/mode/standalone/explain/09_0039_target_build_merge_into_standalone.test index 46199069ff991..61da3a0a24efa 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/09_0039_target_build_merge_into_standalone.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/09_0039_target_build_merge_into_standalone.test @@ -60,7 +60,7 @@ explain merge into target_build_optimization as t1 using source_optimization as MergeInto: target_table: default.default.target_build_optimization ├── distributed: false -├── target_build_optimization: true +├── target_build_optimization: false ├── can_try_update_column_only: true ├── matched update: [condition: None,update set a = t2.a (#0),b = t2.b (#1),c = t2.c (#2)] └── unmatched insert: [condition: None,insert into (a,b,c) values(CAST(a (#0) AS Int32 NULL),CAST(b (#1) AS String NULL),CAST(c (#2) AS String NULL))] @@ -135,7 +135,7 @@ explain merge into target_build_optimization as t1 using source_optimization as MergeInto: target_table: default.default.target_build_optimization ├── distributed: false -├── target_build_optimization: true +├── target_build_optimization: false ├── can_try_update_column_only: true ├── matched update: [condition: None,update set a = t2.a (#0),b = t2.b (#1),c = t2.c (#2)] └── unmatched insert: [condition: None,insert into (a,b,c) values(CAST(a (#0) AS Int32 NULL),CAST(b (#1) AS String NULL),CAST(c (#2) AS String NULL))] diff --git a/tests/sqllogictests/suites/mode/standalone/explain/merge_into.test b/tests/sqllogictests/suites/mode/standalone/explain/merge_into.test index a886f9c810934..eb6a3be9ae2d7 100644 --- a/tests/sqllogictests/suites/mode/standalone/explain/merge_into.test +++ b/tests/sqllogictests/suites/mode/standalone/explain/merge_into.test @@ -174,7 +174,7 @@ on t1.a = t2.a when matched then update set t1.b = t2.b when not matched then in MergeInto: target_table: default.default.column_only_optimization_target ├── distributed: false -├── target_build_optimization: true +├── target_build_optimization: false ├── can_try_update_column_only: true ├── matched update: [condition: None,update set b = t2.b (#1)] └── unmatched insert: [condition: None,insert into (a,b) values(CAST(a (#0) AS Int32 NULL),CAST(b (#1) AS String NULL))] @@ -211,7 +211,7 @@ on t1.a = t2.a when matched then update * when not matched then insert *; MergeInto: target_table: default.default.column_only_optimization_target ├── distributed: false -├── target_build_optimization: true +├── target_build_optimization: false ├── can_try_update_column_only: true ├── matched update: [condition: None,update set a = a (#0),b = b (#1)] └── unmatched insert: [condition: None,insert into (a,b) values(CAST(a (#0) AS Int32 NULL),CAST(b (#1) AS String NULL))]