alex-plekhanov commented on code in PR #10424:
URL: https://github.com/apache/ignite/pull/10424#discussion_r1044267653


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/trait/DistributionFunction.java:
##########
@@ -316,4 +327,59 @@ public AffinityDistribution(int cacheId, Object identity) {
             return "affinity[identity=" + identity + ", cacheId=" + cacheId + 
']';
         }
     }
+
+    /**
+     * Correlated distribution, used to bypass set of nodes on the right hand 
of CNLJ and to be restored to
+     * original hash distribution (with remapped keys) by the filter node.
+     */
+    public static final class CorrelatedDistribution extends 
DistributionFunction {
+        /** */
+        private final CorrelationId corrId;
+
+        /** */
+        private final IgniteDistribution target;
+
+        /** */
+        private CorrelatedDistribution(CorrelationId corrId, 
IgniteDistribution target) {
+            this.corrId = corrId;
+            this.target = target;
+
+            assert target.getType() == RelDistribution.Type.HASH_DISTRIBUTED : 
target.getType();
+        }
+
+        /** {@inheritDoc} */
+        @Override public RelDistribution.Type type() {
+            return RelDistribution.Type.RANDOM_DISTRIBUTED;
+        }
+
+        /** {@inheritDoc} */
+        @Override public <Row> Destination<Row> destination(
+            ExecutionContext<Row> ctx,
+            AffinityService affSrvc,
+            ColocationGroup target,
+            ImmutableIntList keys
+        ) {
+            throw new AssertionError("Correlated distribution should be 
converted to delegate before using");
+        }
+
+        /** */
+        public CorrelationId correlationId() {
+            return corrId;
+        }
+
+        /** */
+        public IgniteDistribution target() {
+            return target;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean correlated() {
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override protected String name0() {
+            return "correlated[corrId=" + corrId + ", target=" + target + ']';

Review Comment:
   But it placed on different positions, for example: 
`IGNITE.[].correlated[corrId=$cor0, target=affinity[identity=hash, 
cacheId=-1368047377][0]].rewindable.correlated[$cor0]`, here we know that the 
first is distribution and the second is correlation. Moreover, for distribution 
there will be always field `target`, for correlation there is only a set of 
correlation ids. If you insist on renaming, what name will be better? How about 
just shortening to `corr`?



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