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/06/27 23:20:14 UTC
[2/2] incubator-calcite git commit: [CALCITE-763] Missing translation
from Sort to MutableSort (Maryann Xue)
[CALCITE-763] Missing translation from Sort to MutableSort (Maryann Xue)
Close apache/incubator-calcite#100
Project: http://git-wip-us.apache.org/repos/asf/incubator-calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/8774a671
Tree: http://git-wip-us.apache.org/repos/asf/incubator-calcite/tree/8774a671
Diff: http://git-wip-us.apache.org/repos/asf/incubator-calcite/diff/8774a671
Branch: refs/heads/master
Commit: 8774a671f035d7bbc8fe8fa420ba237941431c08
Parents: e137812
Author: maryannxue <we...@intel.com>
Authored: Fri Jun 26 15:00:48 2015 -0400
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 26 15:28:25 2015 -0700
----------------------------------------------------------------------
.../org/apache/calcite/plan/SubstitutionVisitor.java | 6 ++++++
.../org/apache/calcite/test/MaterializationTest.java | 14 ++++++++++++++
2 files changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/8774a671/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
index 7322d4b..b1c89e6 100644
--- a/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
+++ b/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
@@ -28,6 +28,7 @@ import org.apache.calcite.rel.core.Filter;
import org.apache.calcite.rel.core.Join;
import org.apache.calcite.rel.core.JoinRelType;
import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.core.Sort;
import org.apache.calcite.rel.core.TableScan;
import org.apache.calcite.rel.core.Values;
import org.apache.calcite.rel.logical.LogicalAggregate;
@@ -241,6 +242,11 @@ public class SubstitutionVisitor {
return MutableJoin.of(join.getCluster(), left, right,
join.getCondition(), join.getJoinType(), join.getVariablesStopped());
}
+ if (rel instanceof Sort) {
+ final Sort sort = (Sort) rel;
+ final MutableRel input = toMutable(sort.getInput());
+ return MutableSort.of(input, sort.getCollation(), sort.offset, sort.fetch);
+ }
throw new RuntimeException("cannot translate " + rel + " to MutableRel");
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/8774a671/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
index a8402d6..f0fb54b 100644
--- a/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
+++ b/core/src/test/java/org/apache/calcite/test/MaterializationTest.java
@@ -272,6 +272,20 @@ public class MaterializationTest {
}
@Ignore
+ @Test public void testOrderByQueryOnProjectView() {
+ checkMaterialize(
+ "select \"deptno\", \"empid\" from \"emps\"",
+ "select \"empid\" from \"emps\" order by \"deptno\"");
+ }
+
+ @Ignore
+ @Test public void testOrderByQueryOnOrderByView() {
+ checkMaterialize(
+ "select \"deptno\", \"empid\" from \"emps\" order by \"deptno\"",
+ "select \"empid\" from \"emps\" order by \"deptno\"");
+ }
+
+ @Ignore
@Test public void testDifferentColumnNames() {}
@Ignore