mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Fix LOGICAL_ERROR for join_use_nulls=1 when JOIN contains const from SELECT
This commit is contained in:
parent
f80137626a
commit
cbeda6c60e
@ -230,8 +230,16 @@ void TableJoin::addJoinedColumn(const NameAndTypePair & joined_column)
|
||||
void TableJoin::addJoinedColumnsAndCorrectNullability(ColumnsWithTypeAndName & columns) const
|
||||
{
|
||||
for (auto & col : columns)
|
||||
{
|
||||
if (leftBecomeNullable(col.type))
|
||||
col.type = makeNullable(col.type);
|
||||
{
|
||||
/// No need to nullify constants
|
||||
if (!(col.column && isColumnConst(*col.column)))
|
||||
{
|
||||
col.type = makeNullable(col.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto & col : columns_added_by_join)
|
||||
{
|
||||
|
@ -11,5 +11,11 @@ FROM X
|
||||
RIGHT JOIN Y ON (X.id + 1) = Y.id
|
||||
SETTINGS join_use_nulls=1; -- { serverError 53 }
|
||||
|
||||
-- Logical error: 'Arguments of 'plus' have incorrect data types: '2' of type 'UInt8', '1' of type 'UInt8''.
|
||||
-- Because 1 became toNullable(1), i.e.:
|
||||
-- 2 UInt8 Const(size = 1, UInt8(size = 1))
|
||||
-- 1 UInt8 Const(size = 1, Nullable(size = 1, UInt8(size = 1), UInt8(size = 1)))
|
||||
SELECT 2+1 FROM system.one X RIGHT JOIN system.one Y ON X.dummy+1 = Y.dummy SETTINGS join_use_nulls = 1; -- { serverError 53 }
|
||||
|
||||
DROP TABLE X;
|
||||
DROP TABLE Y;
|
||||
|
Loading…
Reference in New Issue
Block a user