Merge pull request #49240 from ClickHouse/merge-24050

Merge #24050
This commit is contained in:
Alexey Milovidov 2023-04-27 14:51:49 +03:00 committed by GitHub
commit f67bf699a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,18 @@
Logical functions not null
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
Logical functions nullable
0 0 0 0 0
0 1 0 1 1
1 0 0 1 1
1 1 1 1 0
0 \N 0 \N \N
1 \N \N 1 \N
0 0 0
1 1 0
0 0 0
1 1 0
\N \N \N
\N \N \N

View File

@ -0,0 +1,21 @@
SET compile_expressions = 1;
SET min_count_to_compile_expression = 0;
DROP TABLE IF EXISTS test_table;
CREATE TABLE test_table (a UInt8, b UInt8) ENGINE = TinyLog;
INSERT INTO test_table VALUES (0, 0), (0, 1), (1, 0), (1, 1);
SELECT 'Logical functions not null';
SELECT a, b, and(a, b), or(a, b), xor(a, b) FROM test_table;
DROP TABLE test_table;
DROP TABLE IF EXISTS test_table_nullable;
CREATE TABLE test_table_nullable (a UInt8, b Nullable(UInt8)) ENGINE = TinyLog;
INSERT INTO test_table_nullable VALUES (0, 0), (0, 1), (1, 0), (1, 1), (0, NULL), (1, NULL);
SELECT 'Logical functions nullable';
SELECT a, b, and(a, b), or(a, b), xor(a, b) FROM test_table_nullable;
SELECT and(b, b), or(b, b), xor(b, b) FROM test_table_nullable;
DROP TABLE test_table_nullable;