tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject [1/2] tajo git commit: TAJO-1597: Problem of ignoring theta join condition. (jihoon)
Date Fri, 24 Jul 2015 03:33:19 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 61d1d3304 -> bcec5eb7e


http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash.plan b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash.plan
index c0b6f82..cf59edb 100644
--- a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash.plan
+++ b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash.plan
@@ -2,37 +2,39 @@ explain
 -------------------------------
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(0) on default.nation as n
-        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      TABLE_SUBQUERY(6) as default.t
-        => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-         GROUP_BY(4)(r_regionkey)
-           => exprs: (count())
-           => target list: default.r.r_regionkey (INT4), cnt (INT8)
-           => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-           => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-            JOIN(11)(INNER)
-              => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
-              => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
-              => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-              => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-               SCAN(2) on default.region as r
-                 => target list: default.r.r_regionkey (INT4)
-                 => out schema: {(1) default.r.r_regionkey (INT4)}
-                 => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
-               SCAN(1) on default.nation as n
-                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-                 => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-                 => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(0) on default.nation as n
+           => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         TABLE_SUBQUERY(6) as default.t
+           => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+            GROUP_BY(4)(r_regionkey)
+              => exprs: (count())
+              => target list: default.r.r_regionkey (INT4), cnt (INT8)
+              => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
+              => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+               JOIN(12)(INNER)
+                 => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
+                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
+                 => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                 => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                  SCAN(2) on default.region as r
+                    => target list: default.r.r_regionkey (INT4)
+                    => out schema: {(1) default.r.r_regionkey (INT4)}
+                    => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
+                  SCAN(1) on default.nation as n
+                    => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+                    => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+                    => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
 explain
 -------------------------------
 -------------------------------------------------------------------------------
@@ -61,12 +63,12 @@ Block Id: eb_0000000000000_0000_000003 [LEAF]
 [Enforcers]
  0: type=Broadcast, tables=default.r
 
-GROUP_BY(16)(r_regionkey)
+GROUP_BY(17)(r_regionkey)
   => exprs: (count())
-  => target list: default.r.r_regionkey (INT4), ?count_4 (INT8)
-  => out schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+  => target list: default.r.r_regionkey (INT4), ?count_5 (INT8)
+  => out schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
   => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-   JOIN(11)(INNER)
+   JOIN(12)(INNER)
      => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
      => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
@@ -93,33 +95,35 @@ Block Id: eb_0000000000000_0000_000006 [INTERMEDIATE]
 [Enforcers]
  0: type=Broadcast, tables=default.n
 
-SORT(20)
+SORT(21)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(0) on default.nation as n
-        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      TABLE_SUBQUERY(6) as default.t
-        => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-         PROJECTION(5)
-           => Targets: default.r.r_regionkey (INT4), cnt (INT8)
-           => out schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
-           => in  schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
-            GROUP_BY(4)(r_regionkey)
-              => exprs: (count(?count_4 (INT8)))
-              => target list: default.r.r_regionkey (INT4), cnt (INT8)
-              => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-              => in schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-               SCAN(17) on eb_0000000000000_0000_000003
-                 => out schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-                 => in schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(0) on default.nation as n
+           => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         TABLE_SUBQUERY(6) as default.t
+           => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+            PROJECTION(5)
+              => Targets: default.r.r_regionkey (INT4), cnt (INT8)
+              => out schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
+              => in  schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
+               GROUP_BY(4)(r_regionkey)
+                 => exprs: (count(?count_5 (INT8)))
+                 => target list: default.r.r_regionkey (INT4), cnt (INT8)
+                 => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
+                 => in schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+                  SCAN(18) on eb_0000000000000_0000_000003
+                    => out schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+                    => in schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
 
 =======================================================
 Block Id: eb_0000000000000_0000_000007 [ROOT]
@@ -133,7 +137,7 @@ Block Id: eb_0000000000000_0000_000007 [ROOT]
 
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   SCAN(21) on eb_0000000000000_0000_000006
+   SCAN(22) on eb_0000000000000_0000_000006
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
      => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash_NoBroadcast.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash_NoBroadcast.plan b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash_NoBroadcast.plan
index 6509afc..d2d5617 100644
--- a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash_NoBroadcast.plan
+++ b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Hash_NoBroadcast.plan
@@ -2,37 +2,39 @@ explain
 -------------------------------
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(0) on default.nation as n
-        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      TABLE_SUBQUERY(6) as default.t
-        => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-         GROUP_BY(4)(r_regionkey)
-           => exprs: (count())
-           => target list: default.r.r_regionkey (INT4), cnt (INT8)
-           => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-           => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-            JOIN(11)(INNER)
-              => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
-              => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
-              => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-              => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-               SCAN(2) on default.region as r
-                 => target list: default.r.r_regionkey (INT4)
-                 => out schema: {(1) default.r.r_regionkey (INT4)}
-                 => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
-               SCAN(1) on default.nation as n
-                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-                 => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-                 => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(0) on default.nation as n
+           => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         TABLE_SUBQUERY(6) as default.t
+           => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+            GROUP_BY(4)(r_regionkey)
+              => exprs: (count())
+              => target list: default.r.r_regionkey (INT4), cnt (INT8)
+              => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
+              => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+               JOIN(12)(INNER)
+                 => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
+                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
+                 => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                 => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                  SCAN(2) on default.region as r
+                    => target list: default.r.r_regionkey (INT4)
+                    => out schema: {(1) default.r.r_regionkey (INT4)}
+                    => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
+                  SCAN(1) on default.nation as n
+                    => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+                    => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+                    => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
 explain
 -------------------------------
 -------------------------------------------------------------------------------
@@ -94,20 +96,20 @@ Block Id: eb_0000000000000_0000_000003 [INTERMEDIATE]
 [Outgoing]
 [q_0000000000000_0000] 3 => 4 (type=HASH_SHUFFLE, key=default.r.r_regionkey (INT4), num=32)
 
-GROUP_BY(16)(r_regionkey)
+GROUP_BY(17)(r_regionkey)
   => exprs: (count())
-  => target list: default.r.r_regionkey (INT4), ?count_4 (INT8)
-  => out schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+  => target list: default.r.r_regionkey (INT4), ?count_5 (INT8)
+  => out schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
   => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-   JOIN(11)(INNER)
+   JOIN(12)(INNER)
      => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
      => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
      => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-      SCAN(15) on eb_0000000000000_0000_000002
+      SCAN(16) on eb_0000000000000_0000_000002
         => out schema: {(1) default.r.r_regionkey (INT4)}
         => in schema: {(1) default.r.r_regionkey (INT4)}
-      SCAN(14) on eb_0000000000000_0000_000001
+      SCAN(15) on eb_0000000000000_0000_000001
         => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
         => in schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
 
@@ -130,13 +132,13 @@ TABLE_SUBQUERY(6) as default.t
      => out schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
      => in  schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
       GROUP_BY(4)(r_regionkey)
-        => exprs: (count(?count_4 (INT8)))
+        => exprs: (count(?count_5 (INT8)))
         => target list: default.r.r_regionkey (INT4), cnt (INT8)
         => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-        => in schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-         SCAN(17) on eb_0000000000000_0000_000003
-           => out schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-           => in schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+        => in schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+         SCAN(18) on eb_0000000000000_0000_000003
+           => out schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+           => in schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
 
 =======================================================
 Block Id: eb_0000000000000_0000_000005 [LEAF]
@@ -161,19 +163,21 @@ Block Id: eb_0000000000000_0000_000006 [INTERMEDIATE]
 [Outgoing]
 [q_0000000000000_0000] 6 => 7 (type=RANGE_SHUFFLE, key=default.n.n_nationkey (INT4), num=32)
 
-SORT(20)
+SORT(21)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(19) on eb_0000000000000_0000_000005
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      SCAN(18) on eb_0000000000000_0000_000004
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(20) on eb_0000000000000_0000_000005
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         SCAN(19) on eb_0000000000000_0000_000004
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
 
 =======================================================
 Block Id: eb_0000000000000_0000_000007 [ROOT]
@@ -187,7 +191,7 @@ Block Id: eb_0000000000000_0000_000007 [ROOT]
 
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   SCAN(21) on eb_0000000000000_0000_000006
+   SCAN(22) on eb_0000000000000_0000_000006
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
      => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort.plan b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort.plan
index c0b6f82..cf59edb 100644
--- a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort.plan
+++ b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort.plan
@@ -2,37 +2,39 @@ explain
 -------------------------------
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(0) on default.nation as n
-        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      TABLE_SUBQUERY(6) as default.t
-        => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-         GROUP_BY(4)(r_regionkey)
-           => exprs: (count())
-           => target list: default.r.r_regionkey (INT4), cnt (INT8)
-           => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-           => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-            JOIN(11)(INNER)
-              => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
-              => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
-              => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-              => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-               SCAN(2) on default.region as r
-                 => target list: default.r.r_regionkey (INT4)
-                 => out schema: {(1) default.r.r_regionkey (INT4)}
-                 => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
-               SCAN(1) on default.nation as n
-                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-                 => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-                 => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(0) on default.nation as n
+           => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         TABLE_SUBQUERY(6) as default.t
+           => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+            GROUP_BY(4)(r_regionkey)
+              => exprs: (count())
+              => target list: default.r.r_regionkey (INT4), cnt (INT8)
+              => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
+              => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+               JOIN(12)(INNER)
+                 => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
+                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
+                 => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                 => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                  SCAN(2) on default.region as r
+                    => target list: default.r.r_regionkey (INT4)
+                    => out schema: {(1) default.r.r_regionkey (INT4)}
+                    => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
+                  SCAN(1) on default.nation as n
+                    => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+                    => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+                    => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
 explain
 -------------------------------
 -------------------------------------------------------------------------------
@@ -61,12 +63,12 @@ Block Id: eb_0000000000000_0000_000003 [LEAF]
 [Enforcers]
  0: type=Broadcast, tables=default.r
 
-GROUP_BY(16)(r_regionkey)
+GROUP_BY(17)(r_regionkey)
   => exprs: (count())
-  => target list: default.r.r_regionkey (INT4), ?count_4 (INT8)
-  => out schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+  => target list: default.r.r_regionkey (INT4), ?count_5 (INT8)
+  => out schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
   => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-   JOIN(11)(INNER)
+   JOIN(12)(INNER)
      => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
      => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
@@ -93,33 +95,35 @@ Block Id: eb_0000000000000_0000_000006 [INTERMEDIATE]
 [Enforcers]
  0: type=Broadcast, tables=default.n
 
-SORT(20)
+SORT(21)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(0) on default.nation as n
-        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      TABLE_SUBQUERY(6) as default.t
-        => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-         PROJECTION(5)
-           => Targets: default.r.r_regionkey (INT4), cnt (INT8)
-           => out schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
-           => in  schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
-            GROUP_BY(4)(r_regionkey)
-              => exprs: (count(?count_4 (INT8)))
-              => target list: default.r.r_regionkey (INT4), cnt (INT8)
-              => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-              => in schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-               SCAN(17) on eb_0000000000000_0000_000003
-                 => out schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-                 => in schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(0) on default.nation as n
+           => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         TABLE_SUBQUERY(6) as default.t
+           => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+            PROJECTION(5)
+              => Targets: default.r.r_regionkey (INT4), cnt (INT8)
+              => out schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
+              => in  schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
+               GROUP_BY(4)(r_regionkey)
+                 => exprs: (count(?count_5 (INT8)))
+                 => target list: default.r.r_regionkey (INT4), cnt (INT8)
+                 => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
+                 => in schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+                  SCAN(18) on eb_0000000000000_0000_000003
+                    => out schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+                    => in schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
 
 =======================================================
 Block Id: eb_0000000000000_0000_000007 [ROOT]
@@ -133,7 +137,7 @@ Block Id: eb_0000000000000_0000_000007 [ROOT]
 
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   SCAN(21) on eb_0000000000000_0000_000006
+   SCAN(22) on eb_0000000000000_0000_000006
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
      => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort_NoBroadcast.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort_NoBroadcast.plan b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort_NoBroadcast.plan
index 6509afc..d2d5617 100644
--- a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort_NoBroadcast.plan
+++ b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.Sort_NoBroadcast.plan
@@ -2,37 +2,39 @@ explain
 -------------------------------
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(0) on default.nation as n
-        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      TABLE_SUBQUERY(6) as default.t
-        => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-         GROUP_BY(4)(r_regionkey)
-           => exprs: (count())
-           => target list: default.r.r_regionkey (INT4), cnt (INT8)
-           => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-           => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-            JOIN(11)(INNER)
-              => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
-              => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
-              => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-              => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-               SCAN(2) on default.region as r
-                 => target list: default.r.r_regionkey (INT4)
-                 => out schema: {(1) default.r.r_regionkey (INT4)}
-                 => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
-               SCAN(1) on default.nation as n
-                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
-                 => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-                 => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(0) on default.nation as n
+           => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         TABLE_SUBQUERY(6) as default.t
+           => Targets: default.t.cnt (INT8), default.t.r_regionkey (INT4)
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in  schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+            GROUP_BY(4)(r_regionkey)
+              => exprs: (count())
+              => target list: default.r.r_regionkey (INT4), cnt (INT8)
+              => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
+              => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+               JOIN(12)(INNER)
+                 => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
+                 => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
+                 => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                 => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
+                  SCAN(2) on default.region as r
+                    => target list: default.r.r_regionkey (INT4)
+                    => out schema: {(1) default.r.r_regionkey (INT4)}
+                    => in schema: {(3) default.r.r_comment (TEXT), default.r.r_name (TEXT), default.r.r_regionkey (INT4)}
+                  SCAN(1) on default.nation as n
+                    => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)
+                    => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+                    => in schema: {(4) default.n.n_comment (TEXT), default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
 explain
 -------------------------------
 -------------------------------------------------------------------------------
@@ -94,20 +96,20 @@ Block Id: eb_0000000000000_0000_000003 [INTERMEDIATE]
 [Outgoing]
 [q_0000000000000_0000] 3 => 4 (type=HASH_SHUFFLE, key=default.r.r_regionkey (INT4), num=32)
 
-GROUP_BY(16)(r_regionkey)
+GROUP_BY(17)(r_regionkey)
   => exprs: (count())
-  => target list: default.r.r_regionkey (INT4), ?count_4 (INT8)
-  => out schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+  => target list: default.r.r_regionkey (INT4), ?count_5 (INT8)
+  => out schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
   => in schema:{(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-   JOIN(11)(INNER)
+   JOIN(12)(INNER)
      => Join Cond: default.n.n_regionkey (INT4) = default.r.r_regionkey (INT4)
      => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
      => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.r.r_regionkey (INT4)}
-      SCAN(15) on eb_0000000000000_0000_000002
+      SCAN(16) on eb_0000000000000_0000_000002
         => out schema: {(1) default.r.r_regionkey (INT4)}
         => in schema: {(1) default.r.r_regionkey (INT4)}
-      SCAN(14) on eb_0000000000000_0000_000001
+      SCAN(15) on eb_0000000000000_0000_000001
         => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
         => in schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
 
@@ -130,13 +132,13 @@ TABLE_SUBQUERY(6) as default.t
      => out schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
      => in  schema: {(2) cnt (INT8), default.r.r_regionkey (INT4)}
       GROUP_BY(4)(r_regionkey)
-        => exprs: (count(?count_4 (INT8)))
+        => exprs: (count(?count_5 (INT8)))
         => target list: default.r.r_regionkey (INT4), cnt (INT8)
         => out schema:{(2) cnt (INT8), default.r.r_regionkey (INT4)}
-        => in schema:{(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-         SCAN(17) on eb_0000000000000_0000_000003
-           => out schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
-           => in schema: {(2) default.r.r_regionkey (INT4), ?count_4 (INT8)}
+        => in schema:{(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+         SCAN(18) on eb_0000000000000_0000_000003
+           => out schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
+           => in schema: {(2) default.r.r_regionkey (INT4), ?count_5 (INT8)}
 
 =======================================================
 Block Id: eb_0000000000000_0000_000005 [LEAF]
@@ -161,19 +163,21 @@ Block Id: eb_0000000000000_0000_000006 [INTERMEDIATE]
 [Outgoing]
 [q_0000000000000_0000] 6 => 7 (type=RANGE_SHUFFLE, key=default.n.n_nationkey (INT4), num=32)
 
-SORT(20)
+SORT(21)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   JOIN(12)(INNER)
-     => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
-     => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
-     => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
-     => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-      SCAN(19) on eb_0000000000000_0000_000005
-        => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-        => in schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
-      SCAN(18) on eb_0000000000000_0000_000004
-        => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
-        => in schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+   SELECTION(11)
+     => Search Cond: CAST (default.n.n_nationkey (INT4) AS INT8) > default.t.cnt (INT8)
+      JOIN(13)(INNER)
+        => Join Cond: default.n.n_regionkey (INT4) = default.t.r_regionkey (INT4)
+        => target list: default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)
+        => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
+        => in schema: {(5) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+         SCAN(20) on eb_0000000000000_0000_000005
+           => out schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+           => in schema: {(3) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4)}
+         SCAN(19) on eb_0000000000000_0000_000004
+           => out schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
+           => in schema: {(2) default.t.cnt (INT8), default.t.r_regionkey (INT4)}
 
 =======================================================
 Block Id: eb_0000000000000_0000_000007 [ROOT]
@@ -187,7 +191,7 @@ Block Id: eb_0000000000000_0000_000007 [ROOT]
 
 SORT(8)
   => Sort Keys: default.n.n_nationkey (INT4) (asc)
-   SCAN(21) on eb_0000000000000_0000_000006
+   SCAN(22) on eb_0000000000000_0000_000006
      => out schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
      => in schema: {(4) default.n.n_name (TEXT), default.n.n_nationkey (INT4), default.n.n_regionkey (INT4), default.t.cnt (INT8)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.result
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.result b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.result
index f3a26c8..32d64d9 100644
--- a/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.result
+++ b/tajo-core/src/test/resources/results/TestInnerJoinWithSubQuery/testThetaJoinKeyPairs.result
@@ -1,11 +1,5 @@
 n_nationkey,n_name,n_regionkey,cnt
 -------------------------------
-0,ALGERIA,0,5
-1,ARGENTINA,1,5
-2,BRAZIL,1,5
-3,CANADA,1,5
-4,EGYPT,4,5
-5,ETHIOPIA,0,5
 6,FRANCE,3,5
 7,GERMANY,3,5
 8,INDIA,2,5

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash.plan
index a0cc8ea..20f77b3 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -36,9 +36,9 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [Enforcers]
  0: type=Broadcast, tables=default.b
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
index df36af8..ac73ab9 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -65,17 +65,17 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [q_0000000000000_0000] 1 => 3 (type=HASH_SHUFFLE, key=default.a.r_regionkey (INT4), num=32)
 [q_0000000000000_0000] 2 => 3 (type=HASH_SHUFFLE, key=default.b.c_custkey (INT4), num=32)
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
      => in schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(9) on eb_0000000000000_0000_000002
+      SCAN(10) on eb_0000000000000_0000_000002
         => out schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
         => in schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(8) on eb_0000000000000_0000_000001
+      SCAN(9) on eb_0000000000000_0000_000001
         => out schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
         => in schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort.plan
index a0cc8ea..20f77b3 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -36,9 +36,9 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [Enforcers]
  0: type=Broadcast, tables=default.b
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
index df36af8..ac73ab9 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testLeftOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -65,17 +65,17 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [q_0000000000000_0000] 1 => 3 (type=HASH_SHUFFLE, key=default.a.r_regionkey (INT4), num=32)
 [q_0000000000000_0000] 2 => 3 (type=HASH_SHUFFLE, key=default.b.c_custkey (INT4), num=32)
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(LEFT_OUTER)
+   JOIN(7)(LEFT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
      => in schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(9) on eb_0000000000000_0000_000002
+      SCAN(10) on eb_0000000000000_0000_000002
         => out schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
         => in schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(8) on eb_0000000000000_0000_000001
+      SCAN(9) on eb_0000000000000_0000_000001
         => out schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
         => in schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash.plan
index 9564d93..024ebe7 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -36,9 +36,9 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [Enforcers]
  0: type=Broadcast, tables=default.a
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
index 122c0b2..54c7444 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Hash_NoBroadcast.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -65,17 +65,17 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [q_0000000000000_0000] 1 => 3 (type=HASH_SHUFFLE, key=default.a.r_regionkey (INT4), num=32)
 [q_0000000000000_0000] 2 => 3 (type=HASH_SHUFFLE, key=default.b.c_custkey (INT4), num=32)
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
      => in schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(9) on eb_0000000000000_0000_000002
+      SCAN(10) on eb_0000000000000_0000_000002
         => out schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
         => in schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(8) on eb_0000000000000_0000_000001
+      SCAN(9) on eb_0000000000000_0000_000001
         => out schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
         => in schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort.plan
index 9564d93..024ebe7 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -36,9 +36,9 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [Enforcers]
  0: type=Broadcast, tables=default.a
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
index 122c0b2..54c7444 100644
--- a/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
+++ b/tajo-core/src/test/resources/results/TestOuterJoinQuery/testRightOuterJoinWithThetaJoinConditionInWhere.Sort_NoBroadcast.plan
@@ -1,8 +1,8 @@
 explain
 -------------------------------
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
@@ -65,17 +65,17 @@ Block Id: eb_0000000000000_0000_000003 [ROOT]
 [q_0000000000000_0000] 1 => 3 (type=HASH_SHUFFLE, key=default.a.r_regionkey (INT4), num=32)
 [q_0000000000000_0000] 2 => 3 (type=HASH_SHUFFLE, key=default.b.c_custkey (INT4), num=32)
 
-SELECTION(3)
+SELECTION(6)
   => Search Cond: default.a.r_name (TEXT) < default.b.c_name (TEXT)
-   JOIN(6)(RIGHT_OUTER)
+   JOIN(7)(RIGHT_OUTER)
      => Join Cond: default.a.r_regionkey (INT4) = default.b.c_custkey (INT4)
      => target list: default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)
      => out schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
      => in schema: {(11) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4), default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(9) on eb_0000000000000_0000_000002
+      SCAN(10) on eb_0000000000000_0000_000002
         => out schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
         => in schema: {(8) default.b.c_acctbal (FLOAT8), default.b.c_address (TEXT), default.b.c_comment (TEXT), default.b.c_custkey (INT4), default.b.c_mktsegment (TEXT), default.b.c_name (TEXT), default.b.c_nationkey (INT4), default.b.c_phone (TEXT)}
-      SCAN(8) on eb_0000000000000_0000_000001
+      SCAN(9) on eb_0000000000000_0000_000001
         => out schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
         => in schema: {(3) default.a.r_comment (TEXT), default.a.r_name (TEXT), default.a.r_regionkey (INT4)}
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalOptimizer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalOptimizer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalOptimizer.java
index d06c8e2..2bfa4a7 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalOptimizer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/LogicalOptimizer.java
@@ -32,6 +32,7 @@ import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.plan.expr.AlgebraicUtil;
 import org.apache.tajo.plan.expr.EvalNode;
 import org.apache.tajo.plan.expr.EvalTreeUtil;
+import org.apache.tajo.plan.expr.EvalType;
 import org.apache.tajo.plan.joinorder.*;
 import org.apache.tajo.plan.logical.*;
 import org.apache.tajo.plan.rewrite.BaseLogicalPlanRewriteEngine;
@@ -248,9 +249,15 @@ public class LogicalOptimizer {
     @Override
     public LogicalNode visitFilter(JoinGraphContext context, LogicalPlan plan, LogicalPlan.QueryBlock block,
                                    SelectionNode node, Stack<LogicalNode> stack) throws TajoException {
-      // all join predicate candidates must be collected before building the join tree
-      context.addCandidateJoinFilters(
-          TUtil.newList(AlgebraicUtil.toConjunctiveNormalFormArray(node.getQual())));
+      // all join predicate candidates must be collected before building the join tree except non-equality conditions
+      // TODO: non-equality conditions should also be considered as join conditions after TAJO-1554
+      List<EvalNode> candidateJoinQuals = TUtil.newList();
+      for (EvalNode eachEval : AlgebraicUtil.toConjunctiveNormalFormArray(node.getQual())) {
+        if (EvalTreeUtil.isJoinQual(eachEval, false)) {
+          candidateJoinQuals.add(eachEval);
+        }
+      }
+      context.addCandidateJoinFilters(candidateJoinQuals);
       super.visitFilter(context, plan, block, node, stack);
       return node;
     }

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
index 1fa2fe0..1227855 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/expr/EvalTreeUtil.java
@@ -347,7 +347,7 @@ public class EvalTreeUtil {
   }
 
   private static boolean isJoinQualWithOnlyColumns(@Nullable LogicalPlan.QueryBlock block,
-                                            Column left, Column right) {
+                                                   Column left, Column right) {
     String leftQualifier = CatalogUtil.extractQualifier(left.getQualifiedName());
     String rightQualifier = CatalogUtil.extractQualifier(right.getQualifiedName());
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/bcec5eb7/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
index 503f371..98e674e 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/rewrite/rules/FilterPushDownRule.java
@@ -32,6 +32,7 @@ import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.exception.TajoException;
 import org.apache.tajo.exception.TajoInternalError;
 import org.apache.tajo.plan.*;
+import org.apache.tajo.plan.LogicalPlan.QueryBlock;
 import org.apache.tajo.plan.expr.*;
 import org.apache.tajo.plan.logical.*;
 import org.apache.tajo.plan.rewrite.rules.FilterPushDownRule.FilterPushDownContext;
@@ -40,11 +41,7 @@ import org.apache.tajo.plan.util.PlannerUtil;
 import org.apache.tajo.plan.visitor.BasicLogicalPlanVisitor;
 import org.apache.tajo.util.TUtil;
 
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Stack;
+import java.util.*;
 
 /**
  * This rule tries to push down all filter conditions into logical nodes as lower as possible.
@@ -201,7 +198,7 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<FilterPushDownCo
     context.addFiltersTobePushed(notMatched);
 
     notMatched.clear();
-    context.addFiltersTobePushed(nonPushableQuals);
+    context.pushingDownFilters.addAll(nonPushableQuals);
     List<EvalNode> matched = TUtil.newList();
 
     // If the query involves a subquery, the stack can be empty.
@@ -235,9 +232,53 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<FilterPushDownCo
     }
 
     context.pushingDownFilters.removeAll(matched);
+
+    // The selection node for non-equi theta join conditions should be created here
+    // to process those conditions as early as possible.
+    // This should be removed after TAJO-742.
+    if (context.pushingDownFilters.size() > 0) {
+      List<EvalNode> nonEquiThetaJoinQuals = extractNonEquiThetaJoinQuals(context.pushingDownFilters, block, joinNode);
+      if (nonEquiThetaJoinQuals.size() > 0) {
+        SelectionNode selectionNode = createSelectionParentForNonEquiThetaJoinQuals(plan, block, stack, joinNode,
+            nonEquiThetaJoinQuals);
+
+        context.pushingDownFilters.removeAll(nonEquiThetaJoinQuals);
+        return selectionNode;
+      }
+    }
+
     return joinNode;
   }
 
+  private SelectionNode createSelectionParentForNonEquiThetaJoinQuals(LogicalPlan plan,
+                                                                      QueryBlock block,
+                                                                      Stack<LogicalNode> stack,
+                                                                      JoinNode joinNode,
+                                                                      List<EvalNode> nonEquiThetaJoinQuals) {
+    SelectionNode selectionNode = plan.createNode(SelectionNode.class);
+    selectionNode.setInSchema(joinNode.getOutSchema());
+    selectionNode.setOutSchema(joinNode.getOutSchema());
+    selectionNode.setQual(AlgebraicUtil.createSingletonExprFromCNF(nonEquiThetaJoinQuals));
+    block.registerNode(selectionNode);
+
+    LogicalNode parent = stack.peek();
+    if (parent instanceof UnaryNode) {
+      ((UnaryNode) parent).setChild(selectionNode);
+    } else if (parent instanceof BinaryNode) {
+      BinaryNode binaryParent = (BinaryNode) parent;
+      if (binaryParent.getLeftChild().getPID() == joinNode.getPID()) {
+        binaryParent.setLeftChild(selectionNode);
+      } else if (binaryParent.getRightChild().getPID() == joinNode.getPID()) {
+        binaryParent.setRightChild(selectionNode);
+      }
+    } else if (parent instanceof TableSubQueryNode) {
+      ((TableSubQueryNode) parent).setSubQuery(selectionNode);
+    }
+
+    selectionNode.setChild(joinNode);
+    return selectionNode;
+  }
+
   private static Set<EvalNode> extractNonPushableJoinQuals(final LogicalPlan plan,
                                                            final LogicalPlan.QueryBlock block,
                                                            final JoinNode joinNode,
@@ -547,7 +588,7 @@ public class FilterPushDownRule extends BasicLogicalPlanVisitor<FilterPushDownCo
     context.setFiltersTobePushed(transformedMap.keySet());
 
     stack.push(projectionNode);
-    childNode = visit(context, plan, plan.getBlock(childNode), childNode, stack);
+    visit(context, plan, plan.getBlock(childNode), childNode, stack);
     stack.pop();
 
     // find not matched after visiting child


Mime
View raw message