[
https://issues.apache.org/jira/browse/CALCITE-7220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18030951#comment-18030951
]
Dmitry Sysolyatin commented on CALCITE-7220:
--------------------------------------------
[~julianhyde], [~tzolov]
if possible, can you check this PR as well? One thing I also want to do is
deprecate {{{}TableModify.getSourceExpressionList(){}}}. It was added as part
of CALCITE-1527, but I’m not really sure why we need it. According to the
TableModify docs:
{code:java}
for {@code UPDATE}, all old values plus updated new values;
{code}
This means the last elements of the source select RelNode are the same as
getSourceExpressionList(). Also, from the code, sourceSelect already contains
the sourceExpressionList. Any concerns about this? Right now, I’m just filling
it with references to the sourceSelect RelNode list to keep backward
compatibility if someone is already using it
> RelToSqlConverter throws exception for UPDATE with self-referencing column in
> SET
> ---------------------------------------------------------------------------------
>
> Key: CALCITE-7220
> URL: https://issues.apache.org/jira/browse/CALCITE-7220
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.40.0
> Reporter: Dmitry Sysolyatin
> Assignee: Dmitry Sysolyatin
> Priority: Major
> Labels: pull-request-available
>
> The following test
> {code:java}
> @Test void testUpdate() {
> final String sql0 =
> "update \"foodmart\".\"product\" set \"product_name\" =
> \"product_name\" || '_'"
> + "where \"product_id\" > 10";
> final String expected0 = "";
> sql(sql0).ok(expected0);
> }
> {code}
> throws an exception:
> {code:java}
> field ordinal 3 out of range {}
> java.lang.AssertionError: field ordinal 3 out of range {}
> at
> org.apache.calcite.rel.rel2sql.SqlImplementor$AliasContext.field(SqlImplementor.java:1702)
> {code}
> This happens because the current code uses an empty context for exprList. But
> looks like using exprList is not needed at all.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)