Small fix to date casting function. Make cartesian join infinite cost (not supported yet). Enable additional running TPCH queries.
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/c7bdf57e Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/c7bdf57e Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/c7bdf57e Branch: refs/heads/master Commit: c7bdf57e5fb5ae09acb653265427bdac80d55ed4 Parents: 9d3f95d Author: Jacques Nadeau <[email protected]> Authored: Wed Jun 4 18:50:28 2014 -0700 Committer: Jacques Nadeau <[email protected]> Committed: Wed Jun 4 18:57:51 2014 -0700 ---------------------------------------------------------------------- .../drill/exec/expr/fn/impl/DateUtility.java | 9 ++++--- .../exec/planner/common/DrillJoinRelBase.java | 26 +++++++++++--------- .../org/apache/drill/TestTpchDistributed.java | 12 +++------ .../java/org/apache/drill/TestTpchExplain.java | 8 ++---- .../org/apache/drill/TestTpchSingleMode.java | 9 ++----- .../src/test/resources/queries/tpch/15.sql | 2 +- 6 files changed, 30 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c7bdf57e/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java index 0967fb8..d668df2 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateUtility.java @@ -19,10 +19,13 @@ package org.apache.drill.exec.expr.fn.impl; import java.util.HashMap; -import org.joda.time.format.DateTimeFormatter; + import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeParser; +import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatterBuilder; +import org.joda.time.format.DateTimeParser; + +import com.carrotsearch.hppc.ObjectIntOpenHashMap; // Utility class for Date, DateTime, TimeStamp, Interval data types public class DateUtility { @@ -33,7 +36,7 @@ public class DateUtility { * reconstruct the timestamp, we use this index to index through the array timezoneList * and get the corresponding timezone and pass it to joda-time */ - public static HashMap<String, Integer> timezoneMap = new HashMap<String, Integer>(); + public static ObjectIntOpenHashMap<String> timezoneMap = new ObjectIntOpenHashMap<String>(); public static String[] timezoneList = {"Africa/Abidjan", "Africa/Accra", http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c7bdf57e/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java index b9c112d..80f767c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/common/DrillJoinRelBase.java @@ -17,27 +17,21 @@ */ package org.apache.drill.exec.planner.common; -import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; -import org.apache.drill.common.expression.LogicalExpression; -import org.apache.drill.common.logical.data.NamedExpression; -import org.apache.drill.exec.planner.logical.DrillOptiq; -import org.apache.drill.exec.planner.logical.DrillParseContext; +import org.apache.drill.exec.planner.cost.DrillCostBase.DrillCostFactory; import org.eigenbase.rel.InvalidRelException; import org.eigenbase.rel.JoinRelBase; import org.eigenbase.rel.JoinRelType; import org.eigenbase.rel.RelNode; -import org.eigenbase.relopt.Convention; import org.eigenbase.relopt.RelOptCluster; import org.eigenbase.relopt.RelOptCost; import org.eigenbase.relopt.RelOptPlanner; import org.eigenbase.relopt.RelTraitSet; import org.eigenbase.reltype.RelDataType; import org.eigenbase.rex.RexNode; -import org.eigenbase.util.Pair; import com.google.common.collect.Lists; @@ -52,8 +46,18 @@ public abstract class DrillJoinRelBase extends JoinRelBase implements DrillRelNo JoinRelType joinType) throws InvalidRelException { super(cluster, traits, left, right, condition, joinType, Collections.<String> emptySet()); } - - + + @Override + public RelOptCost computeSelfCost(RelOptPlanner planner) { + if(condition.isAlwaysTrue()){ + return ((DrillCostFactory)planner.getCostFactory()).makeInfiniteCost(); + } + return super.computeSelfCost(planner); + } + + + + /** * Returns whether there are any elements in common between left and right. */ @@ -68,11 +72,11 @@ public abstract class DrillJoinRelBase extends JoinRelBase implements DrillRelNo protected static <T> boolean isUnique(List<T> list) { return new HashSet<>(list).size() == list.size(); } - + public List<Integer> getLeftKeys() { return this.leftKeys; } - + public List<Integer> getRightKeys() { return this.rightKeys; } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c7bdf57e/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java b/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java index 5f33f51..c388b3b 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestTpchDistributed.java @@ -45,7 +45,7 @@ public class TestTpchDistributed extends BaseTestQuery{ } @Test - @Ignore // DRILL-534 + @Ignore public void tpch04() throws Exception{ testDistributed("queries/tpch/04.sql"); } @@ -66,13 +66,11 @@ public class TestTpchDistributed extends BaseTestQuery{ } @Test - @Ignore // DRILL-516 public void tpch08() throws Exception{ testDistributed("queries/tpch/08.sql"); } @Test - @Ignore // DRILL-516 public void tpch09() throws Exception{ testDistributed("queries/tpch/09.sql"); } @@ -94,7 +92,6 @@ public class TestTpchDistributed extends BaseTestQuery{ } @Test - @Ignore // DRILL-548 flapping test: issues with writerIndex. public void tpch13() throws Exception{ testDistributed("queries/tpch/13.sql"); } @@ -105,7 +102,7 @@ public class TestTpchDistributed extends BaseTestQuery{ } @Test - @Ignore // requires views. + @Ignore // non-equality join public void tpch15() throws Exception{ testDistributed("queries/tpch/15.sql"); } @@ -116,7 +113,7 @@ public class TestTpchDistributed extends BaseTestQuery{ } @Test - @Ignore // DRILL-517 + @Ignore // non-equality join public void tpch17() throws Exception{ testDistributed("queries/tpch/17.sql"); } @@ -127,13 +124,12 @@ public class TestTpchDistributed extends BaseTestQuery{ } @Test - @Ignore // DRILL-519 + @Ignore // non-equality join public void tpch19() throws Exception{ testDistributed("queries/tpch/19.sql"); } @Test - @Ignore // DRILL-517 public void tpch20() throws Exception{ testDistributed("queries/tpch/20.sql"); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c7bdf57e/exec/java-exec/src/test/java/org/apache/drill/TestTpchExplain.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestTpchExplain.java b/exec/java-exec/src/test/java/org/apache/drill/TestTpchExplain.java index c64f330..68b65e9 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestTpchExplain.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestTpchExplain.java @@ -64,19 +64,16 @@ public class TestTpchExplain extends BaseTestQuery{ } @Test - @Ignore // DRILL-516 public void tpch07() throws Exception{ doExplain("queries/tpch/07.sql"); } @Test - @Ignore // DRILL-516 public void tpch08() throws Exception{ doExplain("queries/tpch/08.sql"); } @Test - @Ignore // DRILL-516 public void tpch09() throws Exception{ doExplain("queries/tpch/09.sql"); } @@ -108,7 +105,7 @@ public class TestTpchExplain extends BaseTestQuery{ } @Test - @Ignore // requires views. + @Ignore // non equality join public void tpch15() throws Exception{ doExplain("queries/tpch/15.sql"); } @@ -119,7 +116,7 @@ public class TestTpchExplain extends BaseTestQuery{ } @Test - @Ignore // DRILL-517 + @Ignore // non-equality join public void tpch17() throws Exception{ doExplain("queries/tpch/17.sql"); } @@ -136,7 +133,6 @@ public class TestTpchExplain extends BaseTestQuery{ } @Test - @Ignore // DRILL-517 public void tpch20() throws Exception{ doExplain("queries/tpch/20.sql"); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c7bdf57e/exec/java-exec/src/test/java/org/apache/drill/TestTpchSingleMode.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestTpchSingleMode.java b/exec/java-exec/src/test/java/org/apache/drill/TestTpchSingleMode.java index d1ea910..edada65 100644 --- a/exec/java-exec/src/test/java/org/apache/drill/TestTpchSingleMode.java +++ b/exec/java-exec/src/test/java/org/apache/drill/TestTpchSingleMode.java @@ -49,7 +49,6 @@ public class TestTpchSingleMode extends BaseTestQuery{ } @Test - @Ignore // DRILL-534 public void tpch04() throws Exception{ testSingleMode("queries/tpch/04.sql"); } @@ -70,13 +69,11 @@ public class TestTpchSingleMode extends BaseTestQuery{ } @Test - @Ignore // DRILL-516 public void tpch08() throws Exception{ testSingleMode("queries/tpch/08.sql"); } @Test - @Ignore // DRILL-516 public void tpch09() throws Exception{ testSingleMode("queries/tpch/09.sql"); } @@ -98,7 +95,6 @@ public class TestTpchSingleMode extends BaseTestQuery{ } @Test - @Ignore // DRILL-548 flapping test: issues with writerIndex. public void tpch13() throws Exception{ testSingleMode("queries/tpch/13.sql"); } @@ -109,7 +105,7 @@ public class TestTpchSingleMode extends BaseTestQuery{ } @Test - @Ignore // Fails with CannotPlanException + @Ignore // public void tpch15() throws Exception{ testSingleMode("queries/tpch/15.sql"); } @@ -120,7 +116,7 @@ public class TestTpchSingleMode extends BaseTestQuery{ } @Test - @Ignore // DRILL-517 + @Ignore // public void tpch17() throws Exception{ testSingleMode("queries/tpch/17.sql"); } @@ -137,7 +133,6 @@ public class TestTpchSingleMode extends BaseTestQuery{ } @Test - @Ignore // DRILL-517 public void tpch20() throws Exception{ testSingleMode("queries/tpch/20.sql"); } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/c7bdf57e/exec/java-exec/src/test/resources/queries/tpch/15.sql ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/test/resources/queries/tpch/15.sql b/exec/java-exec/src/test/resources/queries/tpch/15.sql index 0ffa896..dff842d 100644 --- a/exec/java-exec/src/test/resources/queries/tpch/15.sql +++ b/exec/java-exec/src/test/resources/queries/tpch/15.sql @@ -1,5 +1,5 @@ -- tpch15 using 1395599672 as a seed to the RNG -use dfs.`default`; -- views can only be created in dfs schema +use dfs.tmp; -- views can only be created in dfs schema create view revenue0 (supplier_no, total_revenue) as select
