Repository: tajo Updated Branches: refs/heads/master 9ddda1405 -> f057343ee
TAJO-1781: Join condition is still not found when it exists in OR clause. Closes #698 Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/f057343e Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/f057343e Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/f057343e Branch: refs/heads/master Commit: f057343ee037d4f9ed51cd2b791fb0ce438c20a5 Parents: 9ddda14 Author: Jihoon Son <[email protected]> Authored: Wed Aug 19 23:54:50 2015 +0900 Committer: Jihoon Son <[email protected]> Committed: Wed Aug 19 23:54:50 2015 +0900 ---------------------------------------------------------------------- CHANGES | 3 + .../tajo/engine/eval/TestEvalTreeUtil.java | 4 +- .../engine/query/TestCommonConditionReduce.java | 110 +++++++++++++++++++ .../tajo/engine/query/TestSelectQuery.java | 27 ----- .../TestCommonConditionReduce/test11.plan | 7 ++ .../TestCommonConditionReduce/test11.result | 27 +++++ .../TestCommonConditionReduce/test21.plan | 7 ++ .../TestCommonConditionReduce/test21.result | 27 +++++ .../TestCommonConditionReduce/test31.plan | 7 ++ .../TestCommonConditionReduce/test31.result | 7 ++ .../TestCommonConditionReduce/test41.plan | 7 ++ .../TestCommonConditionReduce/test41.result | 3 + .../TestCommonConditionReduce/test51.plan | 7 ++ .../TestCommonConditionReduce/test51.result | 3 + .../TestCommonConditionReduce/test61.plan | 7 ++ .../TestCommonConditionReduce/test61.result | 4 + .../TestCommonConditionReduce/test71.plan | 7 ++ .../TestCommonConditionReduce/test71.result | 3 + .../TestCommonConditionReduce/test81.plan | 7 ++ .../TestCommonConditionReduce/test81.result | 6 + .../testSelectWithCommonQuals1.1.plan | 7 -- .../testSelectWithCommonQuals1.1.result | 27 ----- .../testSelectWithCommonQuals2.1.plan | 7 -- .../testSelectWithCommonQuals2.1.result | 27 ----- .../testSelectWithCommonQuals3.1.plan | 7 -- .../testSelectWithCommonQuals3.1.result | 7 -- .../results/TestTPCH/testQ2FourJoins.plan | 4 +- .../resources/results/TestTPCH/testTPCHQ5.plan | 8 +- .../apache/tajo/plan/expr/AlgebraicUtil.java | 14 ++- .../org/apache/tajo/plan/expr/BinaryEval.java | 8 +- .../rules/CommonConditionReduceRule.java | 88 ++++++++------- 31 files changed, 324 insertions(+), 160 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 7ae360a..3028bea 100644 --- a/CHANGES +++ b/CHANGES @@ -229,6 +229,9 @@ Release 0.11.0 - unreleased BUG FIXES + TAJO-1781: Join condition is still not found when it exists in OR clause. i + (jihoon) + TAJO-1777: JsonLineDeserializer returns invalid unicode text, if contains control character. (jinho) http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java index 5b6fda4..f5a6e3f 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/eval/TestEvalTreeUtil.java @@ -288,8 +288,8 @@ public class TestEvalTreeUtil { EvalNode [] cnf = AlgebraicUtil.toDisjunctiveNormalFormArray(node); assertEquals(2, cnf.length); - assertEquals("default.people.score (INT4) > 1 AND default.people.score (INT4) < 3", cnf[0].toString()); - assertEquals("7 < default.people.score (INT4) AND default.people.score (INT4) < 10", cnf[1].toString()); + assertEquals("(default.people.score (INT4) > 1 AND default.people.score (INT4) < 3)", cnf[0].toString()); + assertEquals("(7 < default.people.score (INT4) AND default.people.score (INT4) < 10)", cnf[1].toString()); } @Test http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCommonConditionReduce.java ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCommonConditionReduce.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCommonConditionReduce.java new file mode 100644 index 0000000..6972e1f --- /dev/null +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCommonConditionReduce.java @@ -0,0 +1,110 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tajo.engine.query; + +import org.apache.tajo.IntegrationTest; +import org.apache.tajo.QueryTestCaseBase; +import org.apache.tajo.TajoConstants; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import java.sql.ResultSet; + +@Category(IntegrationTest.class) +public class TestCommonConditionReduce extends QueryTestCaseBase { + + public TestCommonConditionReduce() { + super(TajoConstants.DEFAULT_DATABASE_NAME); + } + + @Test + @Option(withExplain = true) + @SimpleTest ( + queries = @QuerySpec("select * from nation where (n_regionkey = 1 or n_name is not null) and (n_regionkey = 1 or n_comment is not null)") + ) + public void test1() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from nation where (n_regionkey = 1 or n_name is not null) and (n_regionkey = 1 or n_name is not null)") + ) + public void test2() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from nation where (n_regionkey = 1 and n_name is not null) or (n_regionkey = 1 and n_comment is not null)") + ) + public void test3() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from lineitem where (l_orderkey = 1 and l_suppkey = 7706 and l_comment is not null) or (l_orderkey = 1 and l_suppkey = 7706 and l_linenumber = 17) or (l_orderkey = 1 and l_suppkey = 7706 and l_commitdate is not null)") + ) + public void test4() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from lineitem where (l_orderkey = 1 and l_suppkey = 7706 and l_comment is not null) and (l_orderkey = 1 and l_suppkey = 7706 and l_linenumber = 1) and (l_orderkey = 1 and l_suppkey = 7706 and l_commitdate is not null)") + ) + public void test5() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from lineitem \n" + + "where (l_orderkey = 1 and (l_suppkey = 7706 or l_comment is not null)) or (l_orderkey = 1 and (l_suppkey = 7706 or l_linenumber = 1)) or (l_orderkey = 1 and (l_suppkey = 7706 or l_commitdate is not null))") + ) + public void test6() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from lineitem \n" + + "where l_orderkey = 1 and l_orderkey = 1 and l_orderkey = 1 and l_orderkey = 1 and l_linenumber = 1") + ) + public void test7() throws Exception { + runSimpleTests(); + } + + @Test + @Option(withExplain = true) + @SimpleTest( + queries = @QuerySpec("select * from lineitem \n" + + "where l_orderkey = 1 and l_orderkey = 1 and l_orderkey = 1 and l_orderkey = 1 or l_linenumber = 1") + ) + public void test8() throws Exception { + runSimpleTests(); + } +} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java index 0fd6fcf..1637c85 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestSelectQuery.java @@ -758,31 +758,4 @@ public class TestSelectQuery extends QueryTestCaseBase { assertResultSet(res); cleanupQuery(res); } - - @Test - @Option(withExplain = true) - @SimpleTest ( - queries = @QuerySpec("select * from nation where (n_regionkey = 1 or n_name is not null) and (n_regionkey = 1 or n_comment is not null)") - ) - public void testSelectWithCommonQuals1() throws Exception { - runSimpleTests(); - } - - @Test - @Option(withExplain = true) - @SimpleTest( - queries = @QuerySpec("select * from nation where (n_regionkey = 1 or n_name is not null) and (n_regionkey = 1 or n_name is not null)") - ) - public void testSelectWithCommonQuals2() throws Exception { - runSimpleTests(); - } - - @Test - @Option(withExplain = true) - @SimpleTest( - queries = @QuerySpec("select * from nation where (n_regionkey = 1 and n_name is not null) or (n_regionkey = 1 and n_comment is not null)") - ) - public void testSelectWithCommonQuals3() throws Exception { - runSimpleTests(); - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.plan new file mode 100644 index 0000000..a13817f --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.nation + => filter: (default.nation.n_regionkey (INT4) = 1 OR (default.nation.n_name (TEXT) IS NOT NULL AND default.nation.n_comment (TEXT) IS NOT NULL)) + => target list: default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4) + => out schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} + => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.result new file mode 100644 index 0000000..91f0969 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test11.result @@ -0,0 +1,27 @@ +n_nationkey,n_name,n_regionkey,n_comment +------------------------------- +0,ALGERIA,0, haggle. carefully final deposits detect slyly agai +1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon +2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special +3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold +4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d +5,ETHIOPIA,0,ven packages wake quickly. regu +6,FRANCE,3,refully final requests. regular, ironi +7,GERMANY,3,l platelets. regular accounts x-ray: unusual, regular acco +8,INDIA,2,ss excuses cajole slyly across the packages. deposits print aroun +9,INDONESIA,2, slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull +10,IRAN,4,efully alongside of the slyly final dependencies. +11,IRAQ,4,nic deposits boost atop the quickly final requests? quickly regula +12,JAPAN,2,ously. final, express gifts cajole a +13,JORDAN,4,ic deposits are blithely about the carefully regular pa +14,KENYA,0, pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t +15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets? +16,MOZAMBIQUE,0,s. ironic, unusual asymptotes wake blithely r +17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun +18,CHINA,2,c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos +19,ROMANIA,3,ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account +20,SAUDI ARABIA,4,ts. silent requests haggle. closely express packages sleep across the blithely +21,VIETNAM,2,hely enticingly express accounts. even, final +22,RUSSIA,3, requests against the platelets use never according to the quickly regular pint +23,UNITED KINGDOM,3,eans boost carefully special requests. accounts are. carefull +24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.plan new file mode 100644 index 0000000..1470a88 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.nation + => filter: (default.nation.n_regionkey (INT4) = 1 OR default.nation.n_name (TEXT) IS NOT NULL) + => target list: default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4) + => out schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} + => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.result new file mode 100644 index 0000000..91f0969 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test21.result @@ -0,0 +1,27 @@ +n_nationkey,n_name,n_regionkey,n_comment +------------------------------- +0,ALGERIA,0, haggle. carefully final deposits detect slyly agai +1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon +2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special +3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold +4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d +5,ETHIOPIA,0,ven packages wake quickly. regu +6,FRANCE,3,refully final requests. regular, ironi +7,GERMANY,3,l platelets. regular accounts x-ray: unusual, regular acco +8,INDIA,2,ss excuses cajole slyly across the packages. deposits print aroun +9,INDONESIA,2, slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull +10,IRAN,4,efully alongside of the slyly final dependencies. +11,IRAQ,4,nic deposits boost atop the quickly final requests? quickly regula +12,JAPAN,2,ously. final, express gifts cajole a +13,JORDAN,4,ic deposits are blithely about the carefully regular pa +14,KENYA,0, pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t +15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets? +16,MOZAMBIQUE,0,s. ironic, unusual asymptotes wake blithely r +17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun +18,CHINA,2,c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos +19,ROMANIA,3,ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account +20,SAUDI ARABIA,4,ts. silent requests haggle. closely express packages sleep across the blithely +21,VIETNAM,2,hely enticingly express accounts. even, final +22,RUSSIA,3, requests against the platelets use never according to the quickly regular pint +23,UNITED KINGDOM,3,eans boost carefully special requests. accounts are. carefull +24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.plan new file mode 100644 index 0000000..1b40b09 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.nation + => filter: (default.nation.n_regionkey (INT4) = 1 AND (default.nation.n_name (TEXT) IS NOT NULL OR default.nation.n_comment (TEXT) IS NOT NULL)) + => target list: default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4) + => out schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} + => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.result new file mode 100644 index 0000000..85bf5bb --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test31.result @@ -0,0 +1,7 @@ +n_nationkey,n_name,n_regionkey,n_comment +------------------------------- +1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon +2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special +3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold +17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun +24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.plan new file mode 100644 index 0000000..67c3700 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.lineitem + => filter: (default.lineitem.l_orderkey (INT4) = 1 AND (default.lineitem.l_suppkey (INT4) = 7706 AND (default.lineitem.l_comment (TEXT) IS NOT NULL OR (default.lineitem.l_linenumber (INT4) = 17 OR default.lineitem.l_commitdate (TEXT) IS NOT NULL)))) + => target list: default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8) + => out schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} + => in schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.result new file mode 100644 index 0000000..05c4b30 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test41.result @@ -0,0 +1,3 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.plan new file mode 100644 index 0000000..5f1d6c0 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.lineitem + => filter: (default.lineitem.l_linenumber (INT4) = 1 AND (default.lineitem.l_orderkey (INT4) = 1 AND (default.lineitem.l_suppkey (INT4) = 7706 AND (default.lineitem.l_comment (TEXT) IS NOT NULL AND default.lineitem.l_commitdate (TEXT) IS NOT NULL)))) + => target list: default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8) + => out schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} + => in schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.result new file mode 100644 index 0000000..05c4b30 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test51.result @@ -0,0 +1,3 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.plan new file mode 100644 index 0000000..fbde5b8 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.lineitem + => filter: (default.lineitem.l_orderkey (INT4) = 1 AND ((default.lineitem.l_suppkey (INT4) = 7706 OR default.lineitem.l_comment (TEXT) IS NOT NULL) OR ((default.lineitem.l_suppkey (INT4) = 7706 OR default.lineitem.l_linenumber (INT4) = 1) OR (default.lineitem.l_suppkey (INT4) = 7706 OR default.lineitem.l_commitdate (TEXT) IS NOT NULL)))) + => target list: default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8) + => out schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} + => in schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.result new file mode 100644 index 0000000..627c635 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test61.result @@ -0,0 +1,4 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the +1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.plan new file mode 100644 index 0000000..2d32965 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.lineitem + => filter: (default.lineitem.l_linenumber (INT4) = 1 AND default.lineitem.l_orderkey (INT4) = 1) + => target list: default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8) + => out schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} + => in schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.result new file mode 100644 index 0000000..05c4b30 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test71.result @@ -0,0 +1,3 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.plan b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.plan new file mode 100644 index 0000000..6390fb0 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.plan @@ -0,0 +1,7 @@ +explain +------------------------------- +SCAN(0) on default.lineitem + => filter: (default.lineitem.l_orderkey (INT4) = 1 OR default.lineitem.l_linenumber (INT4) = 1) + => target list: default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8) + => out schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} + => in schema: {(16) default.lineitem.l_comment (TEXT), default.lineitem.l_commitdate (TEXT), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_linenumber (INT4), default.lineitem.l_linestatus (TEXT), default.lineitem.l_orderkey (INT4), default.lineitem.l_partkey (INT4), default.lineitem.l_quantity (FLOAT8), default.lineitem.l_receiptdate (TEXT), default.lineitem.l_returnflag (TEXT), default.lineitem.l_shipdate (TEXT), default.lineitem.l_shipinstruct (TEXT), default.lineitem.l_shipmode (TEXT), default.lineitem.l_suppkey (INT4), default.lineitem.l_tax (FLOAT8)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.result b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.result new file mode 100644 index 0000000..488e9e6 --- /dev/null +++ b/tajo-core-tests/src/test/resources/results/TestCommonConditionReduce/test81.result @@ -0,0 +1,6 @@ +l_orderkey,l_partkey,l_suppkey,l_linenumber,l_quantity,l_extendedprice,l_discount,l_tax,l_returnflag,l_linestatus,l_shipdate,l_commitdate,l_receiptdate,l_shipinstruct,l_shipmode,l_comment +------------------------------- +1,1,7706,1,17.0,21168.23,0.04,0.02,N,O,1996-03-13,1996-02-12,1996-03-22,DELIVER IN PERSON,TRUCK,egular courts above the +1,1,7311,2,36.0,45983.16,0.09,0.06,N,O,1996-04-12,1996-02-28,1996-04-20,TAKE BACK RETURN,MAIL,ly final dependencies: slyly bold +2,2,1191,1,38.0,44694.46,0.0,0.05,N,O,1997-01-28,1997-01-14,1997-02-02,TAKE BACK RETURN,RAIL,ven requests. deposits breach a +3,2,1798,1,45.0,54058.05,0.06,0.0,R,F,1994-02-02,1994-01-04,1994-02-23,NONE,AIR,ongside of the furiously brave acco http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.plan b/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.plan deleted file mode 100644 index d49b01e..0000000 --- a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.plan +++ /dev/null @@ -1,7 +0,0 @@ -explain -------------------------------- -SCAN(0) on default.nation - => filter: default.nation.n_regionkey (INT4) = 1 OR default.nation.n_name (TEXT) IS NOT NULL AND default.nation.n_comment (TEXT) IS NOT NULL - => target list: default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4) - => out schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} - => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.result b/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.result deleted file mode 100644 index 91f0969..0000000 --- a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals1.1.result +++ /dev/null @@ -1,27 +0,0 @@ -n_nationkey,n_name,n_regionkey,n_comment -------------------------------- -0,ALGERIA,0, haggle. carefully final deposits detect slyly agai -1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon -2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special -3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold -4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d -5,ETHIOPIA,0,ven packages wake quickly. regu -6,FRANCE,3,refully final requests. regular, ironi -7,GERMANY,3,l platelets. regular accounts x-ray: unusual, regular acco -8,INDIA,2,ss excuses cajole slyly across the packages. deposits print aroun -9,INDONESIA,2, slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull -10,IRAN,4,efully alongside of the slyly final dependencies. -11,IRAQ,4,nic deposits boost atop the quickly final requests? quickly regula -12,JAPAN,2,ously. final, express gifts cajole a -13,JORDAN,4,ic deposits are blithely about the carefully regular pa -14,KENYA,0, pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t -15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets? -16,MOZAMBIQUE,0,s. ironic, unusual asymptotes wake blithely r -17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun -18,CHINA,2,c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos -19,ROMANIA,3,ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account -20,SAUDI ARABIA,4,ts. silent requests haggle. closely express packages sleep across the blithely -21,VIETNAM,2,hely enticingly express accounts. even, final -22,RUSSIA,3, requests against the platelets use never according to the quickly regular pint -23,UNITED KINGDOM,3,eans boost carefully special requests. accounts are. carefull -24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.plan b/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.plan deleted file mode 100644 index fa47fda..0000000 --- a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.plan +++ /dev/null @@ -1,7 +0,0 @@ -explain -------------------------------- -SCAN(0) on default.nation - => filter: default.nation.n_regionkey (INT4) = 1 OR default.nation.n_name (TEXT) IS NOT NULL - => target list: default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4) - => out schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} - => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.result b/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.result deleted file mode 100644 index 91f0969..0000000 --- a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals2.1.result +++ /dev/null @@ -1,27 +0,0 @@ -n_nationkey,n_name,n_regionkey,n_comment -------------------------------- -0,ALGERIA,0, haggle. carefully final deposits detect slyly agai -1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon -2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special -3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold -4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d -5,ETHIOPIA,0,ven packages wake quickly. regu -6,FRANCE,3,refully final requests. regular, ironi -7,GERMANY,3,l platelets. regular accounts x-ray: unusual, regular acco -8,INDIA,2,ss excuses cajole slyly across the packages. deposits print aroun -9,INDONESIA,2, slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull -10,IRAN,4,efully alongside of the slyly final dependencies. -11,IRAQ,4,nic deposits boost atop the quickly final requests? quickly regula -12,JAPAN,2,ously. final, express gifts cajole a -13,JORDAN,4,ic deposits are blithely about the carefully regular pa -14,KENYA,0, pending excuses haggle furiously deposits. pending, express pinto beans wake fluffily past t -15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets? -16,MOZAMBIQUE,0,s. ironic, unusual asymptotes wake blithely r -17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun -18,CHINA,2,c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos -19,ROMANIA,3,ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account -20,SAUDI ARABIA,4,ts. silent requests haggle. closely express packages sleep across the blithely -21,VIETNAM,2,hely enticingly express accounts. even, final -22,RUSSIA,3, requests against the platelets use never according to the quickly regular pint -23,UNITED KINGDOM,3,eans boost carefully special requests. accounts are. carefull -24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.plan b/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.plan deleted file mode 100644 index 90adfc4..0000000 --- a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.plan +++ /dev/null @@ -1,7 +0,0 @@ -explain -------------------------------- -SCAN(0) on default.nation - => filter: default.nation.n_regionkey (INT4) = 1 AND default.nation.n_name (TEXT) IS NOT NULL OR default.nation.n_comment (TEXT) IS NOT NULL - => target list: default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4) - => out schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} - => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.result ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.result b/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.result deleted file mode 100644 index 85bf5bb..0000000 --- a/tajo-core-tests/src/test/resources/results/TestSelectQuery/testSelectWithCommonQuals3.1.result +++ /dev/null @@ -1,7 +0,0 @@ -n_nationkey,n_name,n_regionkey,n_comment -------------------------------- -1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon -2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special -3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the tithes. fluffily bold -17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun -24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestTPCH/testQ2FourJoins.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestTPCH/testQ2FourJoins.plan b/tajo-core-tests/src/test/resources/results/TestTPCH/testQ2FourJoins.plan index 945b6e4..dbee0e3 100644 --- a/tajo-core-tests/src/test/resources/results/TestTPCH/testQ2FourJoins.plan +++ b/tajo-core-tests/src/test/resources/results/TestTPCH/testQ2FourJoins.plan @@ -25,7 +25,7 @@ JOIN(14)(INNER) => out schema: {(11) default.part.p_mfgr (TEXT), default.part.p_partkey (INT4), default.part.p_size (INT4), default.part.p_type (TEXT), default.partsupp.ps_supplycost (FLOAT8), default.supplier.s_acctbal (FLOAT8), default.supplier.s_address (TEXT), default.supplier.s_comment (TEXT), default.supplier.s_name (TEXT), default.supplier.s_nationkey (INT4), default.supplier.s_phone (TEXT)} => in schema: {(12) default.part.p_mfgr (TEXT), default.part.p_partkey (INT4), default.part.p_size (INT4), default.part.p_type (TEXT), default.partsupp.ps_partkey (INT4), default.partsupp.ps_supplycost (FLOAT8), default.supplier.s_acctbal (FLOAT8), default.supplier.s_address (TEXT), default.supplier.s_comment (TEXT), default.supplier.s_name (TEXT), default.supplier.s_nationkey (INT4), default.supplier.s_phone (TEXT)} SCAN(7) on default.part - => filter: default.part.p_size (INT4) = 15 AND default.part.p_type (TEXT)LIKE'%BRASS' + => filter: (default.part.p_size (INT4) = 15 AND default.part.p_type (TEXT)LIKE'%BRASS') => target list: default.part.p_mfgr (TEXT), default.part.p_partkey (INT4), default.part.p_size (INT4), default.part.p_type (TEXT) => out schema: {(4) default.part.p_mfgr (TEXT), default.part.p_partkey (INT4), default.part.p_size (INT4), default.part.p_type (TEXT)} => in schema: {(9) default.part.p_brand (TEXT), default.part.p_comment (TEXT), default.part.p_container (TEXT), default.part.p_mfgr (TEXT), default.part.p_name (TEXT), default.part.p_partkey (INT4), default.part.p_retailprice (FLOAT8), default.part.p_size (INT4), default.part.p_type (TEXT)} @@ -127,7 +127,7 @@ Block Id: eb_0000000000000_0000_000004 [LEAF] [q_0000000000000_0000] 4 => 5 (type=HASH_SHUFFLE, key=default.part.p_partkey (INT4), num=32) SCAN(7) on default.part - => filter: default.part.p_size (INT4) = 15 AND default.part.p_type (TEXT)LIKE'%BRASS' + => filter: (default.part.p_size (INT4) = 15 AND default.part.p_type (TEXT)LIKE'%BRASS') => target list: default.part.p_mfgr (TEXT), default.part.p_partkey (INT4), default.part.p_size (INT4), default.part.p_type (TEXT) => out schema: {(4) default.part.p_mfgr (TEXT), default.part.p_partkey (INT4), default.part.p_size (INT4), default.part.p_type (TEXT)} => in schema: {(9) default.part.p_brand (TEXT), default.part.p_comment (TEXT), default.part.p_container (TEXT), default.part.p_mfgr (TEXT), default.part.p_name (TEXT), default.part.p_partkey (INT4), default.part.p_retailprice (FLOAT8), default.part.p_size (INT4), default.part.p_type (TEXT)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-core-tests/src/test/resources/results/TestTPCH/testTPCHQ5.plan ---------------------------------------------------------------------- diff --git a/tajo-core-tests/src/test/resources/results/TestTPCH/testTPCHQ5.plan b/tajo-core-tests/src/test/resources/results/TestTPCH/testTPCHQ5.plan index 77c3f59..594b540 100644 --- a/tajo-core-tests/src/test/resources/results/TestTPCH/testTPCHQ5.plan +++ b/tajo-core-tests/src/test/resources/results/TestTPCH/testTPCHQ5.plan @@ -27,7 +27,7 @@ SORT(8) => out schema: {(3) default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} => in schema: {(4) default.nation.n_comment (TEXT), default.nation.n_name (TEXT), default.nation.n_nationkey (INT4), default.nation.n_regionkey (INT4)} JOIN(18)(INNER) - => Join Cond: default.customer.c_custkey (INT4) = default.orders.o_custkey (INT4) AND default.lineitem.l_suppkey (INT4) = default.supplier.s_suppkey (INT4) + => Join Cond: (default.customer.c_custkey (INT4) = default.orders.o_custkey (INT4) AND default.lineitem.l_suppkey (INT4) = default.supplier.s_suppkey (INT4)) => target list: ?multiply (FLOAT8), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.supplier.s_nationkey (INT4) => out schema: {(4) ?multiply (FLOAT8), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.supplier.s_nationkey (INT4)} => in schema: {(8) ?multiply (FLOAT8), default.customer.c_custkey (INT4), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_suppkey (INT4), default.orders.o_custkey (INT4), default.supplier.s_nationkey (INT4), default.supplier.s_suppkey (INT4)} @@ -37,7 +37,7 @@ SORT(8) => out schema: {(5) ?multiply (FLOAT8), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_suppkey (INT4), default.orders.o_custkey (INT4)} => in schema: {(7) ?multiply (FLOAT8), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_orderkey (INT4), default.lineitem.l_suppkey (INT4), default.orders.o_custkey (INT4), default.orders.o_orderkey (INT4)} SCAN(1) on default.orders - => filter: default.orders.o_orderdate (TEXT) >= 1994-01-01 AND default.orders.o_orderdate (TEXT) < 1995-01-01 + => filter: (default.orders.o_orderdate (TEXT) >= 1994-01-01 AND default.orders.o_orderdate (TEXT) < 1995-01-01) => target list: default.orders.o_custkey (INT4), default.orders.o_orderkey (INT4) => out schema: {(2) default.orders.o_custkey (INT4), default.orders.o_orderkey (INT4)} => in schema: {(9) default.orders.o_clerk (TEXT), default.orders.o_comment (TEXT), default.orders.o_custkey (INT4), default.orders.o_orderdate (TEXT), default.orders.o_orderkey (INT4), default.orders.o_orderpriority (TEXT), default.orders.o_orderstatus (TEXT), default.orders.o_shippriority (INT4), default.orders.o_totalprice (FLOAT8)} @@ -140,7 +140,7 @@ Block Id: eb_0000000000000_0000_000005 [LEAF] [q_0000000000000_0000] 5 => 6 (type=HASH_SHUFFLE, key=default.orders.o_orderkey (INT4), num=32) SCAN(1) on default.orders - => filter: default.orders.o_orderdate (TEXT) >= 1994-01-01 AND default.orders.o_orderdate (TEXT) < 1995-01-01 + => filter: (default.orders.o_orderdate (TEXT) >= 1994-01-01 AND default.orders.o_orderdate (TEXT) < 1995-01-01) => target list: default.orders.o_custkey (INT4), default.orders.o_orderkey (INT4) => out schema: {(2) default.orders.o_custkey (INT4), default.orders.o_orderkey (INT4)} => in schema: {(9) default.orders.o_clerk (TEXT), default.orders.o_comment (TEXT), default.orders.o_custkey (INT4), default.orders.o_orderdate (TEXT), default.orders.o_orderkey (INT4), default.orders.o_orderpriority (TEXT), default.orders.o_orderstatus (TEXT), default.orders.o_shippriority (INT4), default.orders.o_totalprice (FLOAT8)} @@ -228,7 +228,7 @@ Block Id: eb_0000000000000_0000_000007 [INTERMEDIATE] [q_0000000000000_0000] 7 => 11 (type=HASH_SHUFFLE, key=default.supplier.s_nationkey (INT4), num=32) JOIN(18)(INNER) - => Join Cond: default.customer.c_custkey (INT4) = default.orders.o_custkey (INT4) AND default.lineitem.l_suppkey (INT4) = default.supplier.s_suppkey (INT4) + => Join Cond: (default.customer.c_custkey (INT4) = default.orders.o_custkey (INT4) AND default.lineitem.l_suppkey (INT4) = default.supplier.s_suppkey (INT4)) => target list: ?multiply (FLOAT8), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.supplier.s_nationkey (INT4) => out schema: {(4) ?multiply (FLOAT8), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.supplier.s_nationkey (INT4)} => in schema: {(8) ?multiply (FLOAT8), default.customer.c_custkey (INT4), default.lineitem.l_discount (FLOAT8), default.lineitem.l_extendedprice (FLOAT8), default.lineitem.l_suppkey (INT4), default.orders.o_custkey (INT4), default.supplier.s_nationkey (INT4), default.supplier.s_suppkey (INT4)} http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java index cba41c1..d953da1 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/AlgebraicUtil.java @@ -384,18 +384,22 @@ public class AlgebraicUtil { } } + public static EvalNode createSingletonExprFromDNF(Collection<EvalNode> dnfExprs) { + return createSingletonExprFromDNF(dnfExprs.toArray(new EvalNode[dnfExprs.size()])); + } + /** * Convert a list of conjunctive normal forms into a singleton expression. * - * @param cnfExprs + * @param dnfExprs * @return The EvalNode object that merges all CNF-formed expressions. */ - public static EvalNode createSingletonExprFromDNF(EvalNode... cnfExprs) { - if (cnfExprs.length == 1) { - return cnfExprs[0]; + public static EvalNode createSingletonExprFromDNF(EvalNode... dnfExprs) { + if (dnfExprs.length == 1) { + return dnfExprs[0]; } - return createSingletonExprFromDNFRecursive(cnfExprs, 0); + return createSingletonExprFromDNFRecursive(dnfExprs, 0); } private static EvalNode createSingletonExprFromDNFRecursive(EvalNode[] evalNode, int idx) { http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java index 531cb9f..e792c34 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/BinaryEval.java @@ -188,7 +188,13 @@ public class BinaryEval extends EvalNode implements Cloneable { } public String toString() { - return leftExpr +" " + type.getOperatorName() + " "+ rightExpr; + StringBuilder sb = new StringBuilder(); + sb.append(leftExpr).append(" ").append(type.getOperatorName()).append(" ").append(rightExpr); + if (type == EvalType.AND || type == EvalType.OR) { + sb.insert(0, "("); + sb.append(")"); + } + return sb.toString(); } @Override http://git-wip-us.apache.org/repos/asf/tajo/blob/f057343e/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java ---------------------------------------------------------------------- diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java index ac4ef81..f66350a 100644 --- a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java +++ b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/CommonConditionReduceRule.java @@ -160,60 +160,74 @@ public class CommonConditionReduceRule implements LogicalPlanRewriteRule { } private EvalNode rewrite(BinaryEval evalNode) { - // Example qual: ( a | b ) ^ ( a | c ) - EvalType outerType = evalNode.getType(); // type of the outer operation. ex) ^ - EvalType innerType = outerType == EvalType.AND ? EvalType.OR : EvalType.AND; // type of the inner operation. ex) | + // Example qual: ( a OR b ) AND ( a OR c ) + EvalType outerType = evalNode.getType(); // type of the outer operation. ex) AND - EvalNode finalQual; + EvalNode finalQual = evalNode; + if ((evalNode.getLeftExpr().getType() == EvalType.AND || evalNode.getLeftExpr().getType() == EvalType.OR) && + evalNode.getLeftExpr().getType() == evalNode.getRightExpr().getType()) { + EvalNode leftChild = evalNode.getLeftExpr(); + EvalNode rightChild = evalNode.getRightExpr(); - if (evalNode.getLeftExpr().getType() == innerType && - evalNode.getRightExpr().getType() == innerType) { - BinaryEval leftChild = evalNode.getLeftExpr(); - BinaryEval rightChild = evalNode.getRightExpr(); + EvalType innerType = leftChild.getType(); // Find common quals from the left and right children. Set<EvalNode> commonQuals = TUtil.newHashSet(); - Set<EvalNode> childrenOfLeft = TUtil.newHashSet(leftChild.getLeftExpr(), leftChild.getRightExpr()); - for (int i = 0; i < 2; i++) { - if (childrenOfLeft.contains(rightChild.getChild(i))) { - commonQuals.add(rightChild.getChild(i)); + Set<EvalNode> leftChildSplits = innerType == EvalType.AND ? + TUtil.newHashSet(AlgebraicUtil.toConjunctiveNormalFormArray(leftChild)) : + TUtil.newHashSet(AlgebraicUtil.toDisjunctiveNormalFormArray(leftChild)); + Set<EvalNode> rightChildSplits = innerType == EvalType.AND ? + TUtil.newHashSet(AlgebraicUtil.toConjunctiveNormalFormArray(rightChild)) : + TUtil.newHashSet(AlgebraicUtil.toDisjunctiveNormalFormArray(rightChild)); + + for (EvalNode eachLeftChildSplit : leftChildSplits) { + if (rightChildSplits.contains(eachLeftChildSplit)) { + commonQuals.add(eachLeftChildSplit); } } - if (commonQuals.size() == 2) { - // Ex) ( a | b ) ^ ( a | b ) + if (leftChildSplits.size() == rightChildSplits.size() && + commonQuals.size() == leftChildSplits.size()) { + // Ex) ( a OR b ) AND ( a OR b ) // Current binary eval has the same left and right children, so it is useless. // Connect the parent of the current eval and one of the children directly. finalQual = leftChild; - plan.addHistory("Common condition is reduced."); - - } else if (commonQuals.size() == 1) { - // A single common qual is found. - // ( a | b ) ^ ( a | c ) -> a | (b ^ c) - EvalNode commonQual = commonQuals.iterator().next(); - EvalNode nonCommonQual; - - if (leftChild.getLeftExpr().equals(commonQual)) { - nonCommonQual = leftChild.getRightExpr(); - } else { - nonCommonQual = leftChild.getLeftExpr(); - } - - if (rightChild.getLeftExpr().equals(commonQual)) { - nonCommonQual = new BinaryEval(outerType, nonCommonQual, rightChild.getRightExpr()); + } else if (commonQuals.size() == leftChildSplits.size()) { + // Ex) ( a OR b ) AND ( a OR b OR c ) + finalQual = rightChild; + } else if (commonQuals.size() == rightChildSplits.size()) { + // Ex) ( a OR b OR c ) AND ( a OR b ) + finalQual = leftChild; + } else if (commonQuals.size() > 0) { + // Common quals are found. + // ( a OR b ) AND ( a OR c ) -> a OR (b AND c) + + // Find non-common quals. + leftChildSplits.removeAll(commonQuals); + rightChildSplits.removeAll(commonQuals); + + // Recreate both children using non-common quals. + EvalNode commonQual; + if (innerType == EvalType.AND) { + leftChild = AlgebraicUtil.createSingletonExprFromCNF(leftChildSplits); + rightChild = AlgebraicUtil.createSingletonExprFromCNF(rightChildSplits); + commonQual = AlgebraicUtil.createSingletonExprFromCNF(commonQuals); } else { - nonCommonQual = new BinaryEval(outerType, nonCommonQual, rightChild.getLeftExpr()); + leftChild = AlgebraicUtil.createSingletonExprFromDNF(leftChildSplits); + rightChild = AlgebraicUtil.createSingletonExprFromDNF(rightChildSplits); + commonQual = AlgebraicUtil.createSingletonExprFromDNF(commonQuals); } - finalQual = new BinaryEval(innerType, commonQual, nonCommonQual); - plan.addHistory("Common condition is reduced."); - } else { - finalQual = evalNode; + finalQual = new BinaryEval(innerType, commonQual, new BinaryEval(outerType, leftChild, rightChild)); } - } else { - finalQual = evalNode; + } else if (evalNode.getLeftExpr().equals(evalNode.getRightExpr())) { + finalQual = evalNode.getLeftExpr(); } + // Just compare that finalQual and evalNode is the same instance. + if (finalQual != evalNode) { + plan.addHistory("Common condition is reduced."); + } return finalQual; }
