[ 
https://issues.apache.org/jira/browse/IGNITE-27398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-27398:
--------------------------------------
    Description: 
Calcite 1.41 introduced an assertion that checks that the number of columns in 
update list and the number of columns in a target table match. Unfortunately, 
that check does not take into account virtual columns, so it breaks validation 
of every single UPDATE query, because a table in apache ignite has a virtual 
column that returns a partition identifier for a every row.

Code that raise that assertion error:
{noformat}
if (sourceSelect.getSelectList().size() 
   != targetTable.getRowType().getFieldCount() + 
call.getSourceExpressionList().size()) {
    throw new AssertionError(
       "Unexpected select list size. Select list should contain both target 
table columns and "
       + "set expressions");
}
{noformat}

Remove the workaround, by removing convertUpdateFixed. 

---

Calcite issue that might have introduced the bug is [CALCITE-7220] 
RelToSqlConverter throws exception for UPDATE with self-referencing column in 
SET - https://issues.apache.org/jira/browse/CALCITE-7220
There was some fix later in that area of code later, but it didn't resolve the 
issue [CALCITE-7276] SqlToRelConverter throws exception for UPDATE if 
identifier expansion disabled - 
https://issues.apache.org/jira/browse/CALCITE-7276.


  was:
Calcite 1.41 introduced an assertion that checks that the number of columns in 
update list and the number of columns in a target table match. Unfortunately, 
that check does not take into account virtual columns, so it breaks validation 
of every single UPDATE query, because a table in apache ignite has a virtual 
column that returns a partition identifier for a every row.

Code that raise that assertion error:
{noformat}
if (sourceSelect.getSelectList().size() != 
targetTable.getRowType().getFieldCount() + 
call.getSourceExpressionList().size()) {
    throw new AssertionError(
       "Unexpected select list size. Select list should contain both target 
table columns and "
       + "set expressions");
}
{noformat}

Remove the workaround, by removing convertUpdateFixed. 

---

Calcite issue that might have introduced the bug is [CALCITE-7220] 
RelToSqlConverter throws exception for UPDATE with self-referencing column in 
SET - https://issues.apache.org/jira/browse/CALCITE-7220
There was some fix later in that area of code later, but it didn't resolve the 
issue [CALCITE-7276] SqlToRelConverter throws exception for UPDATE if 
identifier expansion disabled - 
https://issues.apache.org/jira/browse/CALCITE-7276.



> Sql. Remove workaround for UPDATE queries virtual columns validation bug 
> introduced in calcite 1.41
> ---------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-27398
>                 URL: https://issues.apache.org/jira/browse/IGNITE-27398
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql ai3
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> Calcite 1.41 introduced an assertion that checks that the number of columns 
> in update list and the number of columns in a target table match. 
> Unfortunately, that check does not take into account virtual columns, so it 
> breaks validation of every single UPDATE query, because a table in apache 
> ignite has a virtual column that returns a partition identifier for a every 
> row.
> Code that raise that assertion error:
> {noformat}
> if (sourceSelect.getSelectList().size() 
>    != targetTable.getRowType().getFieldCount() + 
> call.getSourceExpressionList().size()) {
>     throw new AssertionError(
>        "Unexpected select list size. Select list should contain both target 
> table columns and "
>        + "set expressions");
> }
> {noformat}
> Remove the workaround, by removing convertUpdateFixed. 
> ---
> Calcite issue that might have introduced the bug is [CALCITE-7220] 
> RelToSqlConverter throws exception for UPDATE with self-referencing column in 
> SET - https://issues.apache.org/jira/browse/CALCITE-7220
> There was some fix later in that area of code later, but it didn't resolve 
> the issue [CALCITE-7276] SqlToRelConverter throws exception for UPDATE if 
> identifier expansion disabled - 
> https://issues.apache.org/jira/browse/CALCITE-7276.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to