mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 20:32:43 +00:00
Merge pull request #66751 from ClickHouse/backport/24.6/66655
Backport #66655 to 24.6: Allow scalar subquery in the first argument of IN with new analyzer.
This commit is contained in:
commit
ac5a1b6956
@ -2911,6 +2911,17 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
|
|||||||
|
|
||||||
resolveExpressionNode(in_second_argument, scope, false /*allow_lambda_expression*/, true /*allow_table_expression*/);
|
resolveExpressionNode(in_second_argument, scope, false /*allow_lambda_expression*/, true /*allow_table_expression*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Edge case when the first argument of IN is scalar subquery.
|
||||||
|
auto & in_first_argument = function_in_arguments_nodes[0];
|
||||||
|
auto first_argument_type = in_first_argument->getNodeType();
|
||||||
|
if (first_argument_type == QueryTreeNodeType::QUERY || first_argument_type == QueryTreeNodeType::UNION)
|
||||||
|
{
|
||||||
|
IdentifierResolveScope subquery_scope(in_first_argument, &scope /*parent_scope*/);
|
||||||
|
subquery_scope.subquery_depth = scope.subquery_depth + 1;
|
||||||
|
|
||||||
|
evaluateScalarSubqueryIfNeeded(in_first_argument, subquery_scope);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize function argument columns
|
/// Initialize function argument columns
|
||||||
|
@ -12,3 +12,6 @@
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
0
|
0
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
@ -21,3 +21,7 @@ SELECT (1, 2) IN 1; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
|||||||
SELECT (1, 2) IN [1]; -- { serverError INCORRECT_ELEMENT_OF_SET }
|
SELECT (1, 2) IN [1]; -- { serverError INCORRECT_ELEMENT_OF_SET }
|
||||||
SELECT (1, 2) IN (((1, 2), (1, 2)), ((1, 2), (1, 2))); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
SELECT (1, 2) IN (((1, 2), (1, 2)), ((1, 2), (1, 2))); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||||
SELECT (1, 2) IN [((1, 2), (1, 2)), ((1, 2), (1, 2))]; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
SELECT (1, 2) IN [((1, 2), (1, 2)), ((1, 2), (1, 2))]; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||||
|
|
||||||
|
select (select 1) in (1);
|
||||||
|
select in(untuple(((1), (1))));
|
||||||
|
select in(untuple(((select 1), (1))));
|
||||||
|
Loading…
Reference in New Issue
Block a user