mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #35674 from vdimir/asof-key-null-issue-35565
This commit is contained in:
commit
b80f24957e
@ -512,14 +512,6 @@ TableJoin::createConvertingActions(const ColumnsWithTypeAndName & left_sample_co
|
||||
template <typename LeftNamesAndTypes, typename RightNamesAndTypes>
|
||||
void TableJoin::inferJoinKeyCommonType(const LeftNamesAndTypes & left, const RightNamesAndTypes & right, bool allow_right)
|
||||
{
|
||||
if (strictness() == ASTTableJoin::Strictness::Asof)
|
||||
{
|
||||
if (clauses.size() != 1)
|
||||
throw DB::Exception("ASOF join over multiple keys is not supported", ErrorCodes::NOT_IMPLEMENTED);
|
||||
if (right.back().type->isNullable())
|
||||
throw DB::Exception("ASOF join over right table Nullable column is not implemented", ErrorCodes::NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
if (!left_type_map.empty() || !right_type_map.empty())
|
||||
return;
|
||||
|
||||
@ -531,6 +523,15 @@ void TableJoin::inferJoinKeyCommonType(const LeftNamesAndTypes & left, const Rig
|
||||
for (const auto & col : right)
|
||||
right_types[renamedRightColumnName(col.name)] = col.type;
|
||||
|
||||
if (strictness() == ASTTableJoin::Strictness::Asof)
|
||||
{
|
||||
if (clauses.size() != 1)
|
||||
throw DB::Exception("ASOF join over multiple keys is not supported", ErrorCodes::NOT_IMPLEMENTED);
|
||||
|
||||
auto asof_key_type = right_types.find(clauses.back().key_names_right.back());
|
||||
if (asof_key_type != right_types.end() && asof_key_type->second->isNullable())
|
||||
throw DB::Exception("ASOF join over right table Nullable column is not implemented", ErrorCodes::NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
forAllKeys(clauses, [&](const auto & left_key_name, const auto & right_key_name)
|
||||
{
|
||||
|
@ -109,3 +109,8 @@ FROM (SELECT toUInt8(number) > 0 as pk, toNullable(toUInt8(number)) as dt FROM n
|
||||
ASOF JOIN (SELECT 1 as pk, toNullable(0) as dt) b
|
||||
ON a.dt >= b.dt AND a.pk = b.pk
|
||||
ORDER BY a.dt; -- { serverError 48 }
|
||||
|
||||
SELECT *
|
||||
FROM (SELECT NULL AS y, 1 AS x, '2020-01-01 10:10:10' :: DateTime64 AS t) AS t1
|
||||
ASOF LEFT JOIN (SELECT NULL AS y, 1 AS x, '2020-01-01 10:10:10' :: DateTime64 AS t) AS t2
|
||||
ON t1.t <= t2.t AND t1.x == t2.x FORMAT Null;
|
||||
|
Loading…
Reference in New Issue
Block a user