You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2015/08/08 17:21:53 UTC

[1/2] incubator-calcite git commit: [CALCITE-822] Revert incorrect LogicalAggregate collation inferring logic made in CALCITE-783 (Milinda Pathirage)

Repository: incubator-calcite
Updated Branches:
  refs/heads/master 0357573f5 -> e827bf0a2


[CALCITE-822] Revert incorrect LogicalAggregate collation inferring logic made in CALCITE-783 (Milinda Pathirage)


Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/ac934f69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/ac934f69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/ac934f69

Branch: refs/heads/master
Commit: ac934f695db39d88beb5a12c792ba7da68cc386e
Parents: 0357573
Author: Milinda Pathirage <mi...@gmail.com>
Authored: Fri Aug 7 08:24:11 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Aug 7 18:43:05 2015 -0700

----------------------------------------------------------------------
 .../calcite/rel/logical/LogicalAggregate.java    | 19 +------------------
 .../org/apache/calcite/test/LatticeTest.java     |  2 +-
 2 files changed, 2 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ac934f69/core/src/main/java/org/apache/calcite/rel/logical/LogicalAggregate.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/logical/LogicalAggregate.java b/core/src/main/java/org/apache/calcite/rel/logical/LogicalAggregate.java
index 650e8a6..d6b9e57 100644
--- a/core/src/main/java/org/apache/calcite/rel/logical/LogicalAggregate.java
+++ b/core/src/main/java/org/apache/calcite/rel/logical/LogicalAggregate.java
@@ -19,8 +19,6 @@ package org.apache.calcite.rel.logical;
 import org.apache.calcite.plan.Convention;
 import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
 import org.apache.calcite.rel.RelInput;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.RelShuttle;
@@ -28,9 +26,6 @@ import org.apache.calcite.rel.core.Aggregate;
 import org.apache.calcite.rel.core.AggregateCall;
 import org.apache.calcite.util.ImmutableBitSet;
 
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-
 import java.util.List;
 
 /**
@@ -96,19 +91,7 @@ public final class LogicalAggregate extends Aggregate {
       List<ImmutableBitSet> groupSets,
       List<AggregateCall> aggCalls) {
     final RelOptCluster cluster = input.getCluster();
-    final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE).replaceIfs(
-        RelCollationTraitDef.INSTANCE,
-        new Supplier<List<RelCollation>>() {
-          public List<RelCollation> get() {
-            List<RelCollation> collations =
-                input.getTraitSet().getTraits(RelCollationTraitDef.INSTANCE);
-            if (collations != null) {
-              return collations;
-            }
-
-            return ImmutableList.of();
-          }
-        });
+    final RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE);
     return new LogicalAggregate(cluster, traitSet, input, indicator, groupSet,
         groupSets, aggCalls);
   }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ac934f69/core/src/test/java/org/apache/calcite/test/LatticeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/LatticeTest.java b/core/src/test/java/org/apache/calcite/test/LatticeTest.java
index b1155f0..77e7943 100644
--- a/core/src/test/java/org/apache/calcite/test/LatticeTest.java
+++ b/core/src/test/java/org/apache/calcite/test/LatticeTest.java
@@ -436,7 +436,7 @@ public class LatticeTest {
                 + "GROUP BY \"s\".\"unit_sales\", \"p\".\"recyclable_package\", \"t\".\"the_day\", \"t\".\"the_year\", \"t\".\"quarter\", \"pc\".\"product_family\"")
         .explainContains(
             "JdbcToEnumerableConverter\n"
-                + "  JdbcAggregate(group=[{7, 16, 25, 27, 31, 37}], m0=[COUNT()], m1=[$SUM0($5)], m2=[$SUM0($7)])\n"
+                + "  JdbcAggregate(group=[{7, 16, 25, 27, 31, 37}], m0=[COUNT()], m1=[SUM($5)], m2=[SUM($7)])\n"
                 + "    JdbcJoin(condition=[=($8, $33)], joinType=[inner])\n"
                 + "      JdbcJoin(condition=[=($1, $23)], joinType=[inner])\n"
                 + "        JdbcJoin(condition=[=($0, $9)], joinType=[inner])\n"


[2/2] incubator-calcite git commit: [CALCITE-822] Add a unit test case to test collation of LogicalAggregate

Posted by jh...@apache.org.
[CALCITE-822] Add a unit test case to test collation of LogicalAggregate

Close apache/incubator-calcite#118


Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/e827bf0a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/e827bf0a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/e827bf0a

Branch: refs/heads/master
Commit: e827bf0a2e410e5613dcf407778e4f5735e75c1c
Parents: ac934f6
Author: Jinfeng Ni <jn...@apache.org>
Authored: Fri Aug 7 09:28:22 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Aug 7 18:43:53 2015 -0700

----------------------------------------------------------------------
 core/src/test/resources/sql/agg.oq | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e827bf0a/core/src/test/resources/sql/agg.oq
----------------------------------------------------------------------
diff --git a/core/src/test/resources/sql/agg.oq b/core/src/test/resources/sql/agg.oq
index 771ff86..2fe0cc2 100644
--- a/core/src/test/resources/sql/agg.oq
+++ b/core/src/test/resources/sql/agg.oq
@@ -1092,6 +1092,34 @@ group by m.empno;
 
 !ok
 
+# Collation of LogicalAggregate ([CALCITE-783] and [CALCITE-822])
+select  sum(x) as sum_cnt,
+  count(distinct y) as cnt_dist
+from
+  (
+  select
+    count(*)                as x,
+          t1.job      as y,
+    t1.deptno as z
+  from
+    "scott".emp t1
+  group by t1.job, t1.deptno
+  order by t1.job, t1.deptno
+) sq(x,y,z)
+group by z
+order by sum_cnt;
+
++---------+----------+
+| SUM_CNT | CNT_DIST |
++---------+----------+
+|       3 |        3 |
+|       5 |        3 |
+|       6 |        3 |
++---------+----------+
+(3 rows)
+
+!ok
+
 # [CALCITE-729] IndexOutOfBoundsException in ROLLUP query on JDBC data source
 !use jdbc_scott
 select deptno, job, count(*) as c