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

Kirill Tkalenko updated IGNITE-28852:
-------------------------------------
    Description: 
It was investigated that when overloading a binary operator in the Calcite 
engine, it works for SELECT statements but not for UPDATE statements.
However, this issue was fixed in IGNITE-28801; this ticket proposes adding 
tests for the binary operator in UPDATE and its redefinition.

For example, when overloading the binary operator "-" for the operation 
TIMESTAMP -NIMERIC, SELECT queries work as expected, but UPDATE queries do not; 
this needs to be fixed.
{code:java}
 
sql("create table person(id int primary key, val_ts timestamp)"); 
sql("insert into person values (?, ?)", 1, Timestamp.valueOf("2024-01-01 
00:00:00"));

// Check SELECT - works. 
assertQuery("SELECT val_ts - 1 FROM person") 
    .returns(Timestamp.valueOf("2023-12-31 00:00:00")) 
    .check();

// Check UPDATE - fails. 
assertQuery("UPDATE person SET val_ts = val_ts - 1 WHERE id = ?") 
    .withParams(1) 
    .returns(1L) 
    .check(); {code}

  was:
I discovered that when overloading a binary operator in the Calcite engine, it 
works for SELECT statements but not for UPDATE statements.

For example, when overloading the binary operator "-" for the operation 
TIMESTAMP -NIMERIC, SELECT queries work as expected, but UPDATE queries do not; 
this needs to be fixed.
{code:java}
 
sql("create table person(id int primary key, val_ts timestamp)"); 
sql("insert into person values (?, ?)", 1, Timestamp.valueOf("2024-01-01 
00:00:00"));

// Check SELECT - works. 
assertQuery("SELECT val_ts - 1 FROM person") 
    .returns(Timestamp.valueOf("2023-12-31 00:00:00")) 
    .check();

// Check UPDATE - fails. 
assertQuery("UPDATE person SET val_ts = val_ts - 1 WHERE id = ?") 
    .withParams(1) 
    .returns(1L) 
    .check(); {code}


> Fix DML for overloaded binary operators in Calcite engine
> ---------------------------------------------------------
>
>                 Key: IGNITE-28852
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28852
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Kirill Tkalenko
>            Assignee: Kirill Tkalenko
>            Priority: Major
>              Labels: ignite-2
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> It was investigated that when overloading a binary operator in the Calcite 
> engine, it works for SELECT statements but not for UPDATE statements.
> However, this issue was fixed in IGNITE-28801; this ticket proposes adding 
> tests for the binary operator in UPDATE and its redefinition.
> For example, when overloading the binary operator "-" for the operation 
> TIMESTAMP -NIMERIC, SELECT queries work as expected, but UPDATE queries do 
> not; this needs to be fixed.
> {code:java}
>  
> sql("create table person(id int primary key, val_ts timestamp)"); 
> sql("insert into person values (?, ?)", 1, Timestamp.valueOf("2024-01-01 
> 00:00:00"));
> // Check SELECT - works. 
> assertQuery("SELECT val_ts - 1 FROM person") 
>     .returns(Timestamp.valueOf("2023-12-31 00:00:00")) 
>     .check();
> // Check UPDATE - fails. 
> assertQuery("UPDATE person SET val_ts = val_ts - 1 WHERE id = ?") 
>     .withParams(1) 
>     .returns(1L) 
>     .check(); {code}



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

Reply via email to