Konstantin Orlov created IGNITE-26137:
-----------------------------------------
Summary: Sql. Support MERGE operation in optimized plans
Key: IGNITE-26137
URL: https://issues.apache.org/jira/browse/IGNITE-26137
Project: Ignite
Issue Type: Improvement
Components: sql ai3
Reporter: Konstantin Orlov
As of now, only single-tuple INSERT queries out of all possible DML is mapped
to an optimized KV-plans. Let's extend support for MERGE operation with UPSERT
semantic.
The MERGE has an UPSERT semantic iff all of the listed below are true:
* {{ON}} condition represents predicate over primary key only
* Source specification doesn't involve any dynamic data sources (like tables,
system views, table functions, etc)
* {{WHEN MATCHED THEN UPDATE}} clause explicitly enumerates updates for all
columns (except for pk columns) from the destination table
* {{WHEN NOT MATCHED THEN INSERT}} clause explicitly enumerates updates for all
column from the destination table. Default values are not allowed
* {{INSERT}} clause and {{UPDATE}} clause must refer to the same column of
source for the same target column. For example, if source clause produces tuple
{{(a, b, c)}}, and {{INSERT}} tuple specified as {{(a, c, b)}}, then the only
possible option for the {{UPDATE}} clause is to specify {{SET col_0 = a, col_1
= c, col_2 = b}}.
See {{org.apache.ignite.internal.sql.engine.prepare.KeyValueModifyPlan}} for
reference.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)