tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject tajo git commit: TAJO-1988: Remove some duplicated codes in toString() of Projectable.
Date Wed, 25 Nov 2015 04:36:01 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 0be254c8b -> 8b2fe1145


TAJO-1988: Remove some duplicated codes in toString() of Projectable.

Closes #875


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

Branch: refs/heads/master
Commit: 8b2fe11451c432b58f48a0173e433c12865d5a8c
Parents: 0be254c
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Tue Nov 24 20:34:18 2015 -0800
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Tue Nov 24 20:34:18 2015 -0800

----------------------------------------------------------------------
 CHANGES                                         |  3 +++
 .../org/apache/tajo/plan/logical/JoinNode.java  | 11 ++--------
 .../plan/logical/PartitionedTableScanNode.java  | 23 ++------------------
 .../org/apache/tajo/plan/logical/ScanNode.java  | 15 +++++--------
 4 files changed, 12 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/8b2fe114/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 95158e1..3eec97e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,9 @@ Release 0.12.0 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1988: Remove some duplicated codes in toString() of Projectable.
+    (hyunsik)
+
     TAJO-1984: Removed unused FileTablespace::getSplit methods. (hyunsik)
 
     TAJO-1271: Improve memory usage of Hash-shuffle. (jinho)

http://git-wip-us.apache.org/repos/asf/tajo/blob/8b2fe114/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
index 4584140..d261ab3 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/JoinNode.java
@@ -22,6 +22,7 @@
 package org.apache.tajo.plan.logical;
 
 import com.google.gson.annotations.Expose;
+import org.apache.commons.lang.StringUtils;
 import org.apache.tajo.algebra.JoinType;
 import org.apache.tajo.plan.PlanString;
 import org.apache.tajo.plan.Target;
@@ -99,15 +100,7 @@ public class JoinNode extends BinaryNode implements Projectable, Cloneable
{
     }
 
     if (hasTargets()) {
-      planStr.addExplan("target list: ");
-      boolean first = true;
-      for (Target target : targets) {
-        if (!first) {
-          planStr.appendExplain(", ");
-        }
-        planStr.appendExplain(target.toString());
-        first = false;
-      }
+      planStr.addExplan("target list: ").appendExplain(StringUtils.join(targets, ", "));
     }
 
     planStr.addDetail("out schema: " + getOutSchema());

http://git-wip-us.apache.org/repos/asf/tajo/blob/8b2fe114/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PartitionedTableScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PartitionedTableScanNode.java
b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PartitionedTableScanNode.java
index fdad342..6176882 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PartitionedTableScanNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/PartitionedTableScanNode.java
@@ -20,6 +20,7 @@ package org.apache.tajo.plan.logical;
 
 import com.google.common.base.Objects;
 import com.google.gson.annotations.Expose;
+import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.catalog.TableDesc;
 import org.apache.tajo.plan.PlanString;
@@ -56,18 +57,6 @@ public class PartitionedTableScanNode extends ScanNode {
   public Path [] getInputPaths() {
     return inputPaths;
   }
-	
-	public String toString() {
-    StringBuilder sb = new StringBuilder("Partitions Scan (table=").append(getTableName());
-    if (hasAlias()) {
-      sb.append(", alias=").append(alias);
-    }
-    if (hasQual()) {
-      sb.append(", filter=").append(qual);
-    }
-    sb.append(", uri=").append(getTableDesc().getUri()).append(")");
-	  return sb.toString();
-	}
 
   @Override
   public int hashCode() {
@@ -134,15 +123,7 @@ public class PartitionedTableScanNode extends ScanNode {
     }
 
     if (hasTargets()) {
-      planStr.addExplan("target list: ");
-      boolean first = true;
-      for (Target target : targets) {
-        if (!first) {
-          planStr.appendExplain(", ");
-        }
-        planStr.appendExplain(target.toString());
-        first = false;
-      }
+      planStr.addExplan("target list: ").appendExplain(StringUtils.join(targets, ", "));
     }
 
     planStr.addDetail("out schema: ").appendDetail(getOutSchema().toString());

http://git-wip-us.apache.org/repos/asf/tajo/blob/8b2fe114/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
index 3de8c1d..a3b8001 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/logical/ScanNode.java
@@ -21,6 +21,7 @@ package org.apache.tajo.plan.logical;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.gson.annotations.Expose;
+import org.apache.commons.lang.StringUtils;
 import org.apache.tajo.catalog.CatalogUtil;
 import org.apache.tajo.catalog.Schema;
 import org.apache.tajo.catalog.SchemaUtil;
@@ -34,6 +35,8 @@ import org.apache.tajo.util.TUtil;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.apache.commons.lang.StringUtils.capitalize;
+
 public class ScanNode extends RelationNode implements Projectable, SelectableNode, Cloneable
{
 	@Expose protected TableDesc tableDesc;
   @Expose protected String alias;
@@ -187,7 +190,7 @@ public class ScanNode extends RelationNode implements Projectable, SelectableNod
   }
 	
 	public String toString() {
-    StringBuilder sb = new StringBuilder("Scan (table=").append(getTableName());
+    StringBuilder sb = new StringBuilder(capitalize(getType().name()) + " (table=").append(getTableName());
     if (hasAlias()) {
       sb.append(", alias=").append(alias);
     }
@@ -265,15 +268,7 @@ public class ScanNode extends RelationNode implements Projectable, SelectableNod
     }
 
     if (hasTargets()) {
-      planStr.addExplan("target list: ");
-      boolean first = true;
-      for (Target target : targets) {
-        if (!first) {
-          planStr.appendExplain(", ");
-        }
-        planStr.appendExplain(target.toString());
-        first = false;
-      }
+      planStr.addExplan("target list: ").appendExplain(StringUtils.join(targets, ", "));
     }
 
     planStr.addDetail("out schema: ").appendDetail(getOutSchema().toString());


Mime
View raw message