Tidy up tests

This commit is contained in:
avoiderboi 2023-02-24 12:37:00 +01:00
parent 3c61afb1ca
commit 7f10ba57df
2 changed files with 11 additions and 8 deletions

View File

@ -25,10 +25,12 @@
4 1 11 3 1
4 1 11 3 1
----------
----------
UInt16
UInt32
UInt64
UInt64
----------
5
3
1

View File

@ -12,25 +12,26 @@ INSERT INTO mytable VALUES (3, -100, 200, 10), (0, 0, 10, 4), (3, 0, 10, 3), (4.
SELECT operand, low, high, count, WIDTH_BUCKET(operand, low, high, count) FROM mytable WHERE count != 0;
SELECT '----------';
-- zero is not valid for count
SELECT operand, low, high, count, WIDTH_BUCKET(operand, low, high, count) FROM mytable WHERE count = 0; -- { serverError 36}
SELECT operand, low, high, count, WIDTH_BUCKET(operand, low, high, count) FROM mytable WHERE count = 0; -- { serverError BAD_ARGUMENTS}
-- IntXX types
SELECT toInt64(operand) AS operand, toInt32(low) AS low, toInt16(high) AS high, count, WIDTH_BUCKET(operand, low, high, count) FROM mytable WHERE count != 0;
SELECT '----------';
-- UIntXX types
SELECT toUInt8(operand) AS operand, toUInt16(low) AS low, toUInt32(high) AS high, count, WIDTH_BUCKET(operand, low, high, count) FROM mytable WHERE count != 0;
SELECT '----------';
-- Wrong argument types
SELECT WIDTH_BUCKET(1, 2, 3, -1); -- { serverError 43 }
SELECT WIDTH_BUCKET(1, 2, 3, 1.3); -- { serverError 43 }
SELECT WIDTH_BUCKET('a', 1, 2, 3); -- { serverError 43 }
SELECT WIDTH_BUCKET(1, toUInt128(42), 2, 3); -- { serverError 43 }
SELECT WIDTH_BUCKET(1, 2, toInt128(42), 3); -- { serverError 43 }
SELECT WIDTH_BUCKET(1, 2, 3, toInt256(42)); -- { serverError 43 }
SELECT WIDTH_BUCKET(1, 2, 3, -1); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT WIDTH_BUCKET(1, 2, 3, 1.3); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT WIDTH_BUCKET('a', 1, 2, 3); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT WIDTH_BUCKET(1, toUInt128(42), 2, 3); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT WIDTH_BUCKET(1, 2, toInt128(42), 3); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT WIDTH_BUCKET(1, 2, 3, toInt256(42)); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
SELECT '----------';
-- Return type checks
SELECT toTypeName(WIDTH_BUCKET(1, 2, 3, toUInt8(1)));
SELECT toTypeName(WIDTH_BUCKET(1, 2, 3, toUInt16(1)));
SELECT toTypeName(WIDTH_BUCKET(1, 2, 3, toUInt32(1)));
SELECT toTypeName(WIDTH_BUCKET(1, 2, 3, toUInt64(1)));
SELECT '----------';
-- Test handling ColumnConst
SELECT WIDTH_BUCKET(1, low, high, count) FROM mytable WHERE count != 0;
SELECT WIDTH_BUCKET(operand, 2, high, count) FROM mytable WHERE count != 0;