From 288aa1909d4ead1f80c4b4dc5b00ab7d1ea5d62b Mon Sep 17 00:00:00 2001 From: yibin Date: Tue, 22 Mar 2022 14:06:32 +0800 Subject: [PATCH] Fix special NewDecimal type passed from TiDB (#4329) close pingcap/tiflash#4147 --- dbms/src/Flash/Coprocessor/DAGUtils.cpp | 3 ++- .../expr/special_new_decimal_type.test | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/fullstack-test/expr/special_new_decimal_type.test diff --git a/dbms/src/Flash/Coprocessor/DAGUtils.cpp b/dbms/src/Flash/Coprocessor/DAGUtils.cpp index 7299246eba4..3dfb189f034 100644 --- a/dbms/src/Flash/Coprocessor/DAGUtils.cpp +++ b/dbms/src/Flash/Coprocessor/DAGUtils.cpp @@ -990,11 +990,12 @@ String getColumnNameForColumnExpr(const tipb::Expr & expr, const std::vector & types, tipb::EncodeType encode_type) diff --git a/tests/fullstack-test/expr/special_new_decimal_type.test b/tests/fullstack-test/expr/special_new_decimal_type.test new file mode 100644 index 00000000000..6f15ab394d6 --- /dev/null +++ b/tests/fullstack-test/expr/special_new_decimal_type.test @@ -0,0 +1,26 @@ +# Copyright 2022 PingCAP, Ltd. +# +# 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. + +mysql> drop table if exists test.t +mysql> create table test.t(a int primary key) +mysql> alter table test.t set tiflash replica 1 +func> wait_table test t +mysql> set tidb_enforce_mpp=1; select count(*) from test.t where case when a then isnull(a) else 12.991 end; ++----------+ +| count(*) | ++----------+ +| 0 | ++----------+ + +mysql> drop table test.t