-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: RinChanNOWWW <rinchannow@bupt.edu.cn>
- Loading branch information
1 parent
6c66d09
commit 530d46c
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | | ||
+------+-----------+ |