korlov42 commented on a change in pull request #9581:
URL: https://github.com/apache/ignite/pull/9581#discussion_r761802079



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/TableDescriptorImpl.java
##########
@@ -470,6 +470,31 @@ private IgniteCheckedException 
instantiationException(String typeName, Reflectiv
         return F.t(key, val);
     }
 
+    /** */
+    private <Row> IgniteBiTuple mergeTuple(Row row, List<String> 
updateColList, ExecutionContext<Row> ectx)
+        throws IgniteCheckedException {
+        RowHandler<Row> hnd = ectx.rowHandler();
+
+        int rowColumnsCnt = hnd.columnCount(row);
+
+        if (rowColumnsCnt == descriptors.length)
+            return F.t(insertTuple(row, ectx), null); // Only WHEN NOT MATCHED 
clause in MERGE.
+        else if (rowColumnsCnt == descriptors.length + updateColList.size())
+            return F.t(null, updateTuple(row, updateColList, 0, ectx)); // 
Only WHEN MATCHED clause in MERGE.
+        else {
+            // Both WHEN MATCHED and WHEN NOT MATCHED clauses in MERGE.
+            assert rowColumnsCnt == descriptors.length * 2 + 
updateColList.size() : "Unexpected columns count: " +
+                rowColumnsCnt;
+
+            int updateOffset = descriptors.length; // Offset of fields for 
update statement.
+
+            if (hnd.get(updateOffset + QueryUtils.KEY_COL, row) != null)
+                return F.t(null, updateTuple(row, updateColList, updateOffset, 
ectx));

Review comment:
       Would it be better to replace tuples with a POJO? Something like 
ModifyTuple(key, value, op)? 
   
   > what standard supports merge delete
   
   I looked at 2011 standard. It appears this feature were introduced in 2011 
standard.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to