KYLIN-1792 review changes for readability

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

Branch: refs/heads/1.5.x-HBase1.x
Commit: 13ae6614f6ea98182dc048288fd05d3ec3be7803
Parents: 6f6d779
Author: Li Yang <liy...@apache.org>
Authored: Tue Jul 5 10:57:56 2016 +0800
Committer: Li Yang <liy...@apache.org>
Committed: Tue Jul 5 10:57:56 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kylin/query/relnode/OLAPJoinRel.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/13ae6614/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
----------------------------------------------------------------------
diff --git 
a/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java 
b/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
index f66351b..6dbb81a 100644
--- a/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
+++ b/query/src/main/java/org/apache/kylin/query/relnode/OLAPJoinRel.java
@@ -117,14 +117,15 @@ public class OLAPJoinRel extends EnumerableJoin 
implements OLAPRel {
         this.isTopJoin = !this.context.hasJoin;
         this.context.hasJoin = true;
 
-        int nJoinPossibility = 0;
+        boolean leftHasSubquery = false;
+        boolean rightHasSubquery = false;
 
         // as we keep the first table as fact table, we need to visit from 
left to right
         implementor.visitChild(this.left, this);
         if (this.context != implementor.getContext() || ((OLAPRel) 
this.left).hasSubQuery()) {
             this.hasSubQuery = true;
+            leftHasSubquery = true;
             // if child is also an OLAPJoin, then the context has already been 
popped
-            nJoinPossibility--;
             if (this.context != implementor.getContext()) {
                 implementor.freeContext();
             }
@@ -132,7 +133,7 @@ public class OLAPJoinRel extends EnumerableJoin implements 
OLAPRel {
         implementor.visitChild(this.right, this);
         if (this.context != implementor.getContext() || ((OLAPRel) 
this.right).hasSubQuery()) {
             this.hasSubQuery = true;
-            nJoinPossibility++;
+            rightHasSubquery = true;
             // if child is also an OLAPJoin, then the context has already been 
popped
             if (this.context != implementor.getContext()) {
                 implementor.freeContext();
@@ -157,13 +158,13 @@ public class OLAPJoinRel extends EnumerableJoin 
implements OLAPRel {
             join.setType(joinType);
 
             this.context.joins.add(join);
-        } else if (0 != nJoinPossibility) {
+        } else if (leftHasSubquery != rightHasSubquery) {
             //When join contains subquery, the join-condition fields of 
fact_table will add into context.
             Map<TblColRef, TblColRef> joinCol = new HashMap<TblColRef, 
TblColRef>();
             translateJoinColumn((RexCall) this.getCondition(), joinCol);
 
             for (Map.Entry<TblColRef, TblColRef> columnPair : 
joinCol.entrySet()) {
-                TblColRef fromCol = (-1 == nJoinPossibility ? 
columnPair.getValue() : columnPair.getKey());
+                TblColRef fromCol = (rightHasSubquery ? columnPair.getKey() : 
columnPair.getValue());
                 this.context.groupByColumns.add(fromCol);
             }
             joinCol.clear();

Reply via email to