tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject git commit: TAJO-729: PreLogicalPlanVerifier verifies distinct aggregation functions incorrectly. (hyunsik)
Date Fri, 04 Apr 2014 07:46:29 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.8.0 4dc22f760 -> e5519cf0b


TAJO-729: PreLogicalPlanVerifier verifies distinct aggregation functions incorrectly. (hyunsik)


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

Branch: refs/heads/branch-0.8.0
Commit: e5519cf0badfa997f623fe1137f5e234edfecc66
Parents: 4dc22f7
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Fri Apr 4 16:11:14 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Fri Apr 4 16:30:54 2014 +0900

----------------------------------------------------------------------
 CHANGES.txt                                                 | 3 +++
 .../apache/tajo/engine/planner/PreLogicalPlanVerifier.java  | 2 +-
 .../java/org/apache/tajo/engine/query/TestGroupByQuery.java | 9 +++++++++
 .../queries/TestGroupByQuery/testDistinctAggregation6.sql   | 9 +++++++++
 .../TestGroupByQuery/testDistinctAggregation6.result        | 5 +++++
 5 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/e5519cf0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 9925663..3be6c34 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -301,6 +301,9 @@ Release 0.8.0 - unreleased
 
   BUG FIXES
 
+    TAJO-729: PreLogicalPlanVerifier verifies distinct aggregation functions
+    incorrectly. (hyunsik)
+
     TAJO-719: JUnit test failures. (jinho)
 
     TAJO-713: Missing INET4 in UniformRangePartition. (jihoon)

http://git-wip-us.apache.org/repos/asf/tajo/blob/e5519cf0/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java
b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java
index fef9dc1..cadeff4 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PreLogicalPlanVerifier.java
@@ -83,7 +83,7 @@ public class PreLogicalPlanVerifier extends BaseAlgebraVisitor <PreLogicalPlanVe
         for (GeneralSetFunctionExpr setFunction : exprs) {
           if (distinctValues == null && setFunction.isDistinct()) {
             distinctValues = setFunction.getParams();
-          } else if (distinctValues != null) {
+          } else if (distinctValues != null && setFunction.isDistinct()) {
             if (!Arrays.equals(distinctValues, setFunction.getParams())) {
               Expr [] differences = ObjectArrays.concat(distinctValues, setFunction.getParams(),
Expr.class);
               throw new PlanningException("different DISTINCT columns are not supported yet:
"

http://git-wip-us.apache.org/repos/asf/tajo/blob/e5519cf0/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
index 250d6f4..9e3c375 100644
--- a/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
+++ b/tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
@@ -177,6 +177,15 @@ public class TestGroupByQuery extends QueryTestCaseBase {
   }
 
   @Test
+  public final void testDistinctAggregation6() throws Exception {
+    // select count(distinct l_orderkey), sum(l_orderkey), sum(l_linenumber), count(*) as
v4 from lineitem
+    // group by l_orderkey;
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
+  }
+
+  @Test
   public final void testDistinctAggregationWithHaving1() throws Exception {
     // select l_linenumber, count(*), count(distinct l_orderkey), sum(distinct l_orderkey)
from lineitem
     // group by l_linenumber having sum(distinct l_orderkey) >= 6;

http://git-wip-us.apache.org/repos/asf/tajo/blob/e5519cf0/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql
b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql
new file mode 100644
index 0000000..242eb18
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/queries/TestGroupByQuery/testDistinctAggregation6.sql
@@ -0,0 +1,9 @@
+select
+  count(distinct l_orderkey) as v0,
+  sum(l_orderkey) as v1,
+  sum(l_linenumber) as v2,
+  count(*) as v4
+from
+  lineitem
+group by
+  l_orderkey;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tajo/blob/e5519cf0/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation6.result
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation6.result
b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation6.result
new file mode 100644
index 0000000..cd59b8f
--- /dev/null
+++ b/tajo-core/tajo-core-backend/src/test/resources/results/TestGroupByQuery/testDistinctAggregation6.result
@@ -0,0 +1,5 @@
+v0,v1,v2,v4
+-------------------------------
+1,2,3,2
+1,2,1,1
+1,6,3,2
\ No newline at end of file


Mime
View raw message