mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fixed segfault in compare operators with Nullable types. #1416 [#CLICKHOUSE-3]
This commit is contained in:
parent
4dd1634772
commit
cd5d1d5009
@ -100,7 +100,7 @@ Block createBlockWithNestedColumns(const Block & block, ColumnNumbers args, size
|
||||
if (col.type->isNullable())
|
||||
{
|
||||
bool is_const = col.column->isConst();
|
||||
auto const_col = static_cast<const ColumnConst *>(col.column.get());
|
||||
auto const_col = typeid_cast<const ColumnConst *>(col.column.get());
|
||||
|
||||
if (is_const && !const_col->getDataColumn().isNullable())
|
||||
throw Exception("Column at position " + toString(i + 1) + " with type " + col.type->getName() +
|
||||
|
@ -204,17 +204,12 @@ bool defaultImplementationForNulls(
|
||||
const ColumnWithTypeAndName & source_col = temporary_block.getByPosition(result);
|
||||
ColumnWithTypeAndName & dest_col = block.getByPosition(result);
|
||||
|
||||
if (source_col.column->isConst())
|
||||
dest_col.column = source_col.column;
|
||||
else
|
||||
{
|
||||
/// Initialize the result column.
|
||||
ColumnPtr null_map = std::make_shared<ColumnUInt8>(block.rows(), 0);
|
||||
dest_col.column = std::make_shared<ColumnNullable>(source_col.column, null_map);
|
||||
/// Initialize the result column.
|
||||
ColumnPtr null_map = std::make_shared<ColumnUInt8>(block.rows(), 0);
|
||||
dest_col.column = std::make_shared<ColumnNullable>(source_col.column, null_map);
|
||||
|
||||
/// Deduce the null map of the result from the null maps of the nullable columns.
|
||||
createNullMap(block, args, result);
|
||||
}
|
||||
/// Deduce the null map of the result from the null maps of the nullable columns.
|
||||
createNullMap(block, args, result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
1
|
||||
1
|
||||
\N
|
||||
|
@ -1,2 +1,3 @@
|
||||
SELECT CAST(1 AS Nullable(UInt8)) AS id WHERE id = CAST(1 AS Nullable(UInt8));
|
||||
SELECT CAST(1 AS Nullable(UInt8)) AS id WHERE id = 1;
|
||||
SELECT NULL == CAST(toUInt8(0) AS Nullable(UInt8));
|
||||
|
Loading…
Reference in New Issue
Block a user