tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject git commit: TAJO-863: Column order mismatched in the JOIN query with asterisk selection. (Hyoungjun Kim via hyunsik)
Date Thu, 05 Jun 2014 21:32:59 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 26dc6e926 -> 47f6f56c7


TAJO-863: Column order mismatched in the JOIN query with asterisk selection. (Hyoungjun Kim
via hyunsik)

Closes #31


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

Branch: refs/heads/master
Commit: 47f6f56c7ba6feb20bc991cafdafd160ca53684d
Parents: 26dc6e9
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Thu Jun 5 14:18:34 2014 -0700
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Thu Jun 5 14:32:46 2014 -0700

----------------------------------------------------------------------
 CHANGES                                                       | 3 +++
 .../main/java/org/apache/tajo/engine/planner/LogicalPlan.java | 4 +++-
 .../tajo/engine/planner/global/TestBroadcastJoinPlan.java     | 4 ++--
 .../test/java/org/apache/tajo/engine/query/TestJoinQuery.java | 7 +++++++
 .../test/resources/queries/TestJoinQuery/testJoinAsterisk.sql | 3 +++
 .../resources/results/TestJoinQuery/testJoinAsterisk.result   | 7 +++++++
 6 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/47f6f56c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7316e4d..0ebb899 100644
--- a/CHANGES
+++ b/CHANGES
@@ -58,6 +58,9 @@ Release 0.9.0 - unreleased
 
   BUG FIXES
 
+    TAJO-863: Column order mismatched in the JOIN query with asterisk selection. 
+    (Hyoungjun Kim via hyunsik)
+
     TAJO-851: Timestamp type test of TestSQLExpression::testCastFromTable fails 
     in jenkins CI test. (Hyoungjun Kim via hyunsik)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/47f6f56c/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
index 6d3f15f..443ee4b 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlan.java
@@ -585,6 +585,7 @@ public class LogicalPlan {
     private final Map<String, RelationNode> canonicalNameToRelationMap = TUtil.newHashMap();
     private final Map<String, List<String>> aliasMap = TUtil.newHashMap();
     private final Map<OpType, List<Expr>> operatorToExprMap = TUtil.newHashMap();
+    private final List<RelationNode> relationList = TUtil.newList();
     /**
      * It's a map between nodetype and node. node types can be duplicated. So, latest node
type is only kept.
      */
@@ -668,10 +669,11 @@ public class LogicalPlan {
         TUtil.putToNestedList(aliasMap, relation.getTableName(), relation.getCanonicalName());
       }
       canonicalNameToRelationMap.put(relation.getCanonicalName(), relation);
+      relationList.add(relation);
     }
 
     public Collection<RelationNode> getRelations() {
-      return this.canonicalNameToRelationMap.values();
+      return Collections.unmodifiableList(relationList);
     }
 
     public boolean hasTableExpression() {

http://git-wip-us.apache.org/repos/asf/tajo/blob/47f6f56c/tajo-core/src/test/java/org/apache/tajo/engine/planner/global/TestBroadcastJoinPlan.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/planner/global/TestBroadcastJoinPlan.java
b/tajo-core/src/test/java/org/apache/tajo/engine/planner/global/TestBroadcastJoinPlan.java
index b56ab47..0e223c4 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/planner/global/TestBroadcastJoinPlan.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/planner/global/TestBroadcastJoinPlan.java
@@ -348,8 +348,8 @@ public class TestBroadcastJoinPlan {
   @Test
   public final void testBroadcastJoinSubquery() throws IOException, PlanningException {
     String query = "select count(*) from large1 " +
-        "join (select * from small1) a on large1_id = a.small1_id " +
-        "join small2 on large1_id = small2_id";
+        "join small2 on large1_id = small2_id " +
+        "join (select * from small1) a on large1_id = a.small1_id";
 
     LogicalPlanner planner = new LogicalPlanner(catalog);
     LogicalOptimizer optimizer = new LogicalOptimizer(conf);

http://git-wip-us.apache.org/repos/asf/tajo/blob/47f6f56c/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
index 11cf344..b1aca56 100644
--- a/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
+++ b/tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
@@ -369,4 +369,11 @@ public class TestJoinQuery extends QueryTestCaseBase {
     executeString("DROP TABLE JOINS.supplier_ PURGE");
     executeString("DROP DATABASE JOINS");
   }
+
+  @Test
+  public final void testJoinAsterisk() throws Exception {
+    ResultSet res = executeQuery();
+    assertResultSet(res);
+    cleanupQuery(res);
+  }
 }

http://git-wip-us.apache.org/repos/asf/tajo/blob/47f6f56c/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinAsterisk.sql
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinAsterisk.sql b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinAsterisk.sql
new file mode 100644
index 0000000..e3de03c
--- /dev/null
+++ b/tajo-core/src/test/resources/queries/TestJoinQuery/testJoinAsterisk.sql
@@ -0,0 +1,3 @@
+select *
+from nation b
+join customer a on b.n_nationkey = a.c_nationkey

http://git-wip-us.apache.org/repos/asf/tajo/blob/47f6f56c/tajo-core/src/test/resources/results/TestJoinQuery/testJoinAsterisk.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestJoinQuery/testJoinAsterisk.result b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinAsterisk.result
new file mode 100644
index 0000000..d01fa21
--- /dev/null
+++ b/tajo-core/src/test/resources/results/TestJoinQuery/testJoinAsterisk.result
@@ -0,0 +1,7 @@
+n_nationkey,n_name,n_regionkey,n_comment,c_custkey,c_name,c_address,c_nationkey,c_phone,c_acctbal,c_mktsegment,c_comment
+-------------------------------
+1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon,3,Customer#000000003,MG9kdTD2WBHm,1,11-719-748-3364,7498.12,AUTOMOBILE,
deposits eat slyly ironic, even instructions. express foxes detect slyly. blithely even accounts
abov
+3,CANADA,1,eas hang ironic, silent packages. slyly regular packages are furiously over the
tithes. fluffily bold,5,Customer#000000005,KvpyuHCplrB84WgAiGV6sYpZq7Tj,3,13-750-942-6364,794.47,HOUSEHOLD,n
accounts will have to unwind. foxes cajole accor
+4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the
furiously regular d,4,Customer#000000004,XxVSJsLAGtn,4,14-128-190-5944,2866.83,MACHINERY,
requests. final, regular ideas sleep final accou
+13,JORDAN,4,ic deposits are blithely about the carefully regular pa,2,Customer#000000002,XSTf4,NCwDVaWNe6tEgvwfmRchLXak,13,23-768-687-3665,121.65,AUTOMOBILE,l
accounts. blithely ironic theodolites integrate boldly: caref
+15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold
platelets?,1,Customer#000000001,IVhzIApeRb ot,c,E,15,25-989-741-2988,711.56,BUILDING,to the
even, regular platelets. regular, ironic epitaphs nag e
\ No newline at end of file


Mime
View raw message