From e6e69c9291b30e48243ee6de0b2430fae7361a7b Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Tue, 16 Apr 2024 17:58:43 +0800 Subject: [PATCH 1/3] fix GeneratedColumnPlaceHolderTransformAction header Signed-off-by: guo-shaoge --- ...eratedColumnPlaceHolderTransformAction.cpp | 2 +- .../fullstack-test/mpp/generated_column.test | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/fullstack-test/mpp/generated_column.test diff --git a/dbms/src/DataStreams/GeneratedColumnPlaceHolderTransformAction.cpp b/dbms/src/DataStreams/GeneratedColumnPlaceHolderTransformAction.cpp index b4b8fb9ab0e..69a2037f7ca 100644 --- a/dbms/src/DataStreams/GeneratedColumnPlaceHolderTransformAction.cpp +++ b/dbms/src/DataStreams/GeneratedColumnPlaceHolderTransformAction.cpp @@ -54,7 +54,7 @@ void GeneratedColumnPlaceHolderTransformAction::insertColumns(Block & block, boo if (insert_data) column = data_type->createColumnConstWithDefaultValue(block.rows()); else - column = data_type->createColumn(); + column = data_type->createColumnConstWithDefaultValue(0); block.insert(col_index, ColumnWithTypeAndName{column, data_type, col_name}); } } diff --git a/tests/fullstack-test/mpp/generated_column.test b/tests/fullstack-test/mpp/generated_column.test new file mode 100644 index 00000000000..5f9a9fa7cc0 --- /dev/null +++ b/tests/fullstack-test/mpp/generated_column.test @@ -0,0 +1,25 @@ +# Copyright 2023 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Preparation. +mysql> drop table if exists test.t +mysql> create table test.t (a int, b int) +mysql> alter table test.t set tiflash replica 1 +mysql> insert into test.t (col) values (1); + +func> wait_table test t + +mysql> use test; set @@tidb_allow_mpp=0; set @@tidb_allow_tiflash_cop=true; set @@tidb_allow_batch_cop=2; set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp=1; select * from t order by col limit 10; + +mysql> use test; set @@tidb_allow_mpp=1; set @@tidb_enforce_mapp=1; set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp=1; select * from t order by col limit 10; From 65b0b0370c184305e0e128d3b81416530f9653a8 Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Tue, 16 Apr 2024 18:26:33 +0800 Subject: [PATCH 2/3] case Signed-off-by: guo-shaoge --- tests/fullstack-test/mpp/generated_column.test | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/fullstack-test/mpp/generated_column.test b/tests/fullstack-test/mpp/generated_column.test index 5f9a9fa7cc0..2bc5c46b918 100644 --- a/tests/fullstack-test/mpp/generated_column.test +++ b/tests/fullstack-test/mpp/generated_column.test @@ -14,12 +14,16 @@ # Preparation. mysql> drop table if exists test.t -mysql> create table test.t (a int, b int) +mysql> create table test.t (col int null, __col int as (col) virtual); mysql> alter table test.t set tiflash replica 1 mysql> insert into test.t (col) values (1); func> wait_table test t -mysql> use test; set @@tidb_allow_mpp=0; set @@tidb_allow_tiflash_cop=true; set @@tidb_allow_batch_cop=2; set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp=1; select * from t order by col limit 10; +mysql> use test; set @@tidb_allow_mpp=0; set @@tidb_allow_tiflash_cop=true; set @@tidb_allow_batch_cop=2; set @@tidb_isolation_read_engines='tiflash'; select * from t order by col limit 10; +col __col +1 1 -mysql> use test; set @@tidb_allow_mpp=1; set @@tidb_enforce_mapp=1; set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp=1; select * from t order by col limit 10; +mysql> use test; set @@tidb_allow_mpp=1; set @@tidb_enforce_mpp=1; set @@tidb_isolation_read_engines='tiflash'; select * from t order by col limit 10; +col __col +1 1 From fa513173900d1a285e3a9962206e52981e61f817 Mon Sep 17 00:00:00 2001 From: guo-shaoge Date: Tue, 16 Apr 2024 18:27:36 +0800 Subject: [PATCH 3/3] fix Signed-off-by: guo-shaoge --- tests/fullstack-test/mpp/generated_column.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fullstack-test/mpp/generated_column.test b/tests/fullstack-test/mpp/generated_column.test index 2bc5c46b918..87bc809c254 100644 --- a/tests/fullstack-test/mpp/generated_column.test +++ b/tests/fullstack-test/mpp/generated_column.test @@ -1,4 +1,4 @@ -# Copyright 2023 PingCAP, Inc. +# Copyright 2024 PingCAP, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.