Repository navigation
Allow scalar subquery in the first argument of IN with new analyzer. - #66655
Conversation
|
This is an automated comment for commit 9966347 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
| 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); | ||
| } |
There was a problem hiding this comment.
It's better to have something like this:
| 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); | |
| } | |
| resolveExpressionNode(in_first_argument, scope, false /*allow_lambda_expression*/, false /*allow_table_expression*/); |
- If first argument is an alias to table expression, your solution won't work.
allow_table_expression = falsewill treat table expressions as scalar subqueries
There was a problem hiding this comment.
But you probably can't use table expression in the first argument of IN?
with (select 1) as t select in(t, 1) already works, with t as (select 1) select in(t, 1) did not work with old analyzer as well (need to check how it works after the change). What would be an example?
I just don't want to re-resolve the first argument. Especially because resolveExpressionNode can return a new list of projection names.
There was a problem hiding this comment.
with t as (select 1) select in(t, 1) also works in this PR
…of IN with new analyzer.
Backport #66655 to 24.6: Allow scalar subquery in the first argument of IN with new analyzer.
…of IN with new analyzer.
…of IN with new analyzer.
…of IN with new analyzer.
Backport #66655 to 24.4: Allow scalar subquery in the first argument of IN with new analyzer.
Backport #66655 to 24.3: Allow scalar subquery in the first argument of IN with new analyzer.
Backport #66655 to 24.5: Allow scalar subquery in the first argument of IN with new analyzer.
|
Hi @KochetovNicolai @yariks5s — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix
Method getResultType is not supported for QUERY query nodeerror when scalar subquery was used as the first argument of IN (with new analyzer).