mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Avoid crash with big int in prewhere
This commit is contained in:
parent
729692f862
commit
5579d139eb
@ -628,12 +628,12 @@ Block MergeTreeBaseSelectProcessor::transformHeader(
|
||||
else
|
||||
{
|
||||
WhichDataType which(removeNullable(recursiveRemoveLowCardinality(prewhere_column.type)));
|
||||
if (which.isInt() || which.isUInt())
|
||||
if (which.isNativeInt() || which.isNativeUInt())
|
||||
prewhere_column.column = prewhere_column.type->createColumnConst(block.rows(), 1u)->convertToFullColumnIfConst();
|
||||
else if (which.isFloat())
|
||||
prewhere_column.column = prewhere_column.type->createColumnConst(block.rows(), 1.0f)->convertToFullColumnIfConst();
|
||||
else
|
||||
throw Exception("Illegal type " + prewhere_column.type->getName() + " of column for filter.",
|
||||
throw Exception("Illegal type " + prewhere_column.type->getName() + " of column for filter",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER);
|
||||
}
|
||||
}
|
||||
|
15
tests/queries/0_stateless/02473_prewhere_with_bigint.sql
Normal file
15
tests/queries/0_stateless/02473_prewhere_with_bigint.sql
Normal file
@ -0,0 +1,15 @@
|
||||
CREATE TABLE prewhere_int128 (a Int128) ENGINE=MergeTree ORDER BY a;
|
||||
SELECT a FROM prewhere_int128 WHERE a; -- { serverError 59 }
|
||||
DROP TABLE prewhere_int128;
|
||||
|
||||
CREATE TABLE prewhere_int256 (a Int256) ENGINE=MergeTree ORDER BY a;
|
||||
SELECT a FROM prewhere_int256 WHERE a; -- { serverError 59 }
|
||||
DROP TABLE prewhere_int256;
|
||||
|
||||
CREATE TABLE prewhere_uint128 (a UInt128) ENGINE=MergeTree ORDER BY a;
|
||||
SELECT a FROM prewhere_uint128 WHERE a; -- { serverError 59 }
|
||||
DROP TABLE prewhere_uint128;
|
||||
|
||||
CREATE TABLE prewhere_uint256 (a UInt256) ENGINE=MergeTree ORDER BY a;
|
||||
SELECT a FROM prewhere_uint256 WHERE a; -- { serverError 59 }
|
||||
DROP TABLE prewhere_uint256;
|
Loading…
Reference in New Issue
Block a user