Skip to content

Commit

Permalink
Add fullstack tests for BIT_OR.
Browse files Browse the repository at this point in the history
Signed-off-by: RinChanNOWWW <rinchannow@bupt.edu.cn>
  • Loading branch information
RinChanNOWWW committed Jul 7, 2022
1 parent 6c66d09 commit 530d46c
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/fullstack-test/expr/agg_bit_or_pushdown.test
Original file line number Diff line number Diff line change
@@ -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 |
+------+-----------+

0 comments on commit 530d46c

Please sign in to comment.