From 530d46c3dbf21a727c16b2b213e55dc508ff0c84 Mon Sep 17 00:00:00 2001 From: RinChanNOWWW Date: Wed, 6 Jul 2022 15:29:40 +0800 Subject: [PATCH] Add fullstack tests for BIT_OR. Signed-off-by: RinChanNOWWW --- .../expr/agg_bit_or_pushdown.test | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/fullstack-test/expr/agg_bit_or_pushdown.test diff --git a/tests/fullstack-test/expr/agg_bit_or_pushdown.test b/tests/fullstack-test/expr/agg_bit_or_pushdown.test new file mode 100644 index 00000000000..d3c6c5761f7 --- /dev/null +++ b/tests/fullstack-test/expr/agg_bit_or_pushdown.test @@ -0,0 +1,76 @@ +# 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.all_null +mysql> create table test.all_null (a int, b int) +mysql> alter table test.all_null set tiflash replica 1 +mysql> insert into test.all_null values(1, NULL), (1, NULL), (2, NULL), (2, NULL), (3, NULL); + +mysql> drop table if exists test.not_all_null +mysql> create table test.not_all_null (a int, b int) +mysql> alter table test.not_all_null set tiflash replica 1 +mysql> insert into test.not_all_null values(1, 1), (1, 2), (2, 2), (2, 4), (3, NULL), (3, 4); + +mysql> drop table if exists test.char +mysql> create table test.char (a int, b char(10)) +mysql> alter table test.char set tiflash replica 1 +mysql> insert into test.char values(1, '1a'), (1, '2a2'), (2, '2bbb'), (2, '4ccc11'), (3, 'adasda'), (3, 'ASD'); + +mysql> set @@tidb_isolation_read_engines='tiflash' + +mysql> select bit_or(b) from test.all_null; ++-----------+ +| bit_or(b) | ++-----------+ +| 0 | ++-----------+ +mysql> select a, bit_or(b) from test.all_null group by a; ++------+-----------+ +| a | bit_or(b) | ++------+-----------+ +| 1 | 0 | +| 2 | 0 | +| 3 | 0 | ++------+-----------+ + + +mysql> select bit_or(b) from test.not_all_null; ++-----------+ +| bit_or(b) | ++-----------+ +| 7 | ++-----------+ +mysql> select a, bit_or(b) from test.not_all_null group by a; ++------+-----------+ +| a | bit_or(b) | ++------+-----------+ +| 1 | 3 | +| 2 | 6 | +| 3 | 4 | ++------+-----------+ + +mysql> select bit_or(b) from test.char; ++-----------+ +| bit_or(b) | ++-----------+ +| 7 | ++-----------+ +mysql> select a, bit_or(b) from test.char group by a; ++------+-----------+ +| a | bit_or(b) | ++------+-----------+ +| 1 | 3 | +| 2 | 6 | +| 3 | 0 | ++------+-----------+