xtern commented on code in PR #2397:
URL: https://github.com/apache/ignite-3/pull/2397#discussion_r1288567298


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rule/TableModifyConverterRule.java:
##########
@@ -126,4 +138,35 @@ private static PhysicalNode 
createAggregate(IgniteTableModify tableModify, RelOp
 
         return new IgniteProject(cluster, 
outTrait.replace(IgniteDistributions.single()), sumAgg, projections, 
convertedRowType);
     }
+
+    /**
+     * To perform delete we need row with key fields only.
+     * But input distribution contains the indexes of the key columns 
according to the schema (i.e. for the full row).
+     * This method aligns the keys to their indexes so that a row containing 
only the key fields can be read.
+     *
+     * <pre>
+     * For example we have a table with the following columns in the following 
order: a INT, b INT, c INT, d INT.
+     *
+     *  1. (a) is PK. Key fields row contains [a], we can read it using 
0-index. No alignment required.
+     *  2. (b) is PK. Key fields row contains [b], distribution key contains 
logical index '1', which requires it to be "shifted" to '0'.
+     *  3. (b, d) is PK. Key fields row contains [b, d], distribution keys [1, 
3] need to be shifted to [0, 1].
+     *  4. (d, b, c) is PK. Key fields row contains [d, b, c]. distribution 
keys [3, 1, 2] need to be shifted to [2, 0, 1].
+     * </pre>
+     *
+     * @param distribution Distribution specification.
+     * @return Distribution with adjusted keys.
+     */
+    private IgniteDistribution 
adjustDistributionKeysForDelete(IgniteDistribution distribution) {

Review Comment:
   Thank you, I believe it's fixed now.



-- 
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