[
https://issues.apache.org/jira/browse/CALCITE-7637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kirill Tkalenko updated CALCITE-7637:
-------------------------------------
Description:
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}
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: CALCITE-7637
> URL: https://issues.apache.org/jira/browse/CALCITE-7637
> Project: Calcite
> Issue Type: Bug
> Reporter: Kirill Tkalenko
> Assignee: Kirill Tkalenko
> Priority: Major
> Labels: ignite-2
>
> 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}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)