[CALCITE-6570] Add SCALAR_QUERY to sourceExpressionList of SqlUpdate#3966
[CALCITE-6570] Add SCALAR_QUERY to sourceExpressionList of SqlUpdate#3966xtern wants to merge 1 commit into
Conversation
7ae1fac to
54216ca
Compare
54216ca to
f29d170
Compare
| registerSubQueries(selectScope2, | ||
| SqlNonNullableAccessors.getSelectList(select)); | ||
|
|
||
| if (enclosingNode.getKind() == SqlKind.UPDATE) { |
There was a problem hiding this comment.
I wonder whether there are other statements that would need this.
There was a problem hiding this comment.
Thanks, at least MERGE suffers from the same issue.
Added the corresponding test and fix.
f29d170 to
5385399
Compare
5385399 to
c2a1434
Compare
|
|
@mihaibudiu, @caicancai, If the patch needs to be improved, then feel free to remove it from the current scope (1.38.0), so that it doesn't delay the release. |
@xtern Hi. You mean that it can only be recognized as a constant in the physical stage? It feels strange. |
In my previous message I mixed up the Let's turn it off and see the difference in plan tree in existing test Without this fix the plan is: Note that But after applying this patch the plan is: Note that and this looks like an issue that needs to be fixed before merging this PR 😔 |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@calcite.apache.org list. Thank you for your contributions. |



Validation currently fails with an AssertionError on an UPDATE query with a sub-query that requires an implicit type cast. (See CALCITE-6570 for details).
Example
During validation, when registering subqueries, Calcite wraps the sub-query in a SCALAR_QUERY call in
selectList(sqlUpdate.getSourceSelect().getSelectList()).But after that,
TypeCoersiontries to coerce types for expressions insourceExpressionList(seeTypeCoersionImpl.coerceSourceRowType()), but it containsSqlSelectinstead ofSCALAR_QUERYcall.As a solution I added
SCALAR_QUERYtosourceExpressionListas well.