You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by ch...@apache.org on 2022/06/01 00:31:32 UTC

[calcite] branch main updated: [CALCITE-5170] Assertion error on range distribution creation

This is an automated email from the ASF dual-hosted git repository.

chunwei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new a5af80642 [CALCITE-5170] Assertion error on range distribution creation
a5af80642 is described below

commit a5af80642787e3f1d24671d3a6339568d0c6b201
Author: rkondakov <ko...@mail.ru>
AuthorDate: Sun May 29 13:31:30 2022 +0400

    [CALCITE-5170] Assertion error on range distribution creation
---
 .../src/main/java/org/apache/calcite/rel/RelDistributions.java |  2 +-
 .../test/java/org/apache/calcite/rel/RelDistributionTest.java  | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/calcite/rel/RelDistributions.java b/core/src/main/java/org/apache/calcite/rel/RelDistributions.java
index c3aa8f694..769592d39 100644
--- a/core/src/main/java/org/apache/calcite/rel/RelDistributions.java
+++ b/core/src/main/java/org/apache/calcite/rel/RelDistributions.java
@@ -103,7 +103,7 @@ public class RelDistributions {
           || Ordering.natural().isOrdered(keys)
           : "key columns of hash distribution must be in order";
       assert type == Type.HASH_DISTRIBUTED
-          || type == Type.RANDOM_DISTRIBUTED
+          || type == Type.RANGE_DISTRIBUTED
           || keys.isEmpty();
     }
 
diff --git a/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java b/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java
index 264fd4348..6bb59f505 100644
--- a/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java
+++ b/core/src/test/java/org/apache/calcite/rel/RelDistributionTest.java
@@ -25,6 +25,8 @@ import com.google.common.collect.ImmutableList;
 
 import org.junit.jupiter.api.Test;
 
+import java.util.Arrays;
+
 import static org.apache.calcite.rel.RelDistributions.ANY;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -94,4 +96,12 @@ class RelDistributionTest {
   private static RelDistribution hash(int... keys) {
     return RelDistributions.hash(ImmutableIntList.of(keys));
   }
+
+  @Test void testRangeRelDistributionKeys() {
+    RelDistributions.range(Arrays.asList(0, 1));
+  }
+
+  @Test void testHashRelDistributionKeys() {
+    RelDistributions.hash(Arrays.asList(0, 1));
+  }
 }