未验证 提交 a94e223c 编写于 作者: A alesapin 提交者: GitHub

Merge pull request #20344 from azat/join_use_nulls-fix

Fix null dereference with join_use_nulls=1
......@@ -70,8 +70,19 @@ ColumnsWithTypeAndName createBlockWithNestedColumns(const ColumnsWithTypeAndName
}
else if (const auto * const_column = checkAndGetColumn<ColumnConst>(*col.column))
{
const auto & nested_col = checkAndGetColumn<ColumnNullable>(const_column->getDataColumn())->getNestedColumnPtr();
res.emplace_back(ColumnWithTypeAndName{ ColumnConst::create(nested_col, col.column->size()), nested_type, col.name});
const auto * nullable_column = checkAndGetColumn<ColumnNullable>(const_column->getDataColumn());
ColumnPtr nullable_res;
if (nullable_column)
{
const auto & nested_col = nullable_column->getNestedColumnPtr();
nullable_res = ColumnConst::create(nested_col, col.column->size());
}
else
{
nullable_res = makeNullable(col.column);
}
res.emplace_back(ColumnWithTypeAndName{ nullable_res, nested_type, col.name });
}
else
throw Exception("Illegal column for DataTypeNullable", ErrorCodes::ILLEGAL_COLUMN);
......
DROP TABLE IF EXISTS X;
DROP TABLE IF EXISTS Y;
CREATE TABLE X (id Int) ENGINE=Memory;
CREATE TABLE Y (id Int) ENGINE=Memory;
-- Type mismatch of columns to JOIN by: plus(id, 1) Int64 at left, Y.id Int32 at right.
SELECT
Y.id - 1
FROM X
RIGHT JOIN Y ON (X.id + 1) = Y.id
SETTINGS join_use_nulls=1; -- { serverError 53 }
DROP TABLE X;
DROP TABLE Y;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册