drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ve...@apache.org
Subject drill git commit: DRILL-4483: Fix text plan regression in query profiles
Date Tue, 08 Mar 2016 03:12:59 GMT
Repository: drill
Updated Branches:
  refs/heads/master df0f0af3d -> 2850a9fa8


DRILL-4483: Fix text plan regression in query profiles


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

Branch: refs/heads/master
Commit: 2850a9fa89c0a3a5a3c761f894418dee9c3fb8d2
Parents: df0f0af
Author: vkorukanti <venki.korukanti@gmail.com>
Authored: Mon Mar 7 15:08:58 2016 -0800
Committer: vkorukanti <venki@dremio.com>
Committed: Mon Mar 7 19:12:09 2016 -0800

----------------------------------------------------------------------
 .../sql/handlers/CreateTableHandler.java        |  1 +
 .../planner/sql/handlers/DefaultSqlHandler.java | 33 ++++++++------------
 .../planner/sql/handlers/ExplainHandler.java    |  1 +
 3 files changed, 15 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/2850a9fa/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
index 9f5d7e4..0ebb557 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/CreateTableHandler.java
@@ -95,6 +95,7 @@ public class CreateTableHandler extends DefaultSqlHandler {
     // Convert the query to Drill Logical plan and insert a writer operator on top.
     DrillRel drel = convertToDrel(newTblRelNodeWithPCol, drillSchema, newTblName, sqlCreateTable.getPartitionColumns(),
newTblRelNode.getRowType());
     Prel prel = convertToPrel(drel, newTblRelNode.getRowType(), sqlCreateTable.getPartitionColumns());
+    logAndSetTextPlan("Drill Physical", prel, logger);
     PhysicalOperator pop = convertToPop(prel);
     PhysicalPlan plan = convertToPlan(pop);
     log("Drill Plan", plan, logger);

http://git-wip-us.apache.org/repos/asf/drill/blob/2850a9fa/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
index 396a0ef..5152fa6 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/DefaultSqlHandler.java
@@ -128,35 +128,27 @@ public class DefaultSqlHandler extends AbstractSqlHandler {
 
   protected void log(final PlannerType plannerType, final PlannerPhase phase, final RelNode
node, final Logger logger,
       Stopwatch watch) {
-    log(plannerType, phase, node, logger, watch, false);
-  }
-
-  protected void log(final PlannerType plannerType, final PlannerPhase phase, final RelNode
node, final Logger logger,
-      Stopwatch watch, boolean number) {
     if (logger.isDebugEnabled()) {
-      log(plannerType.name() + ":" + phase.description, node, logger, watch, number);
+      log(plannerType.name() + ":" + phase.description, node, logger, watch);
     }
   }
 
   protected void log(final String description, final RelNode node, final Logger logger, Stopwatch
watch) {
-    log(description, node, logger, watch, false);
+    if (logger.isDebugEnabled()) {
+      final String plan = RelOptUtil.toString(node, SqlExplainLevel.ALL_ATTRIBUTES);
+      final String time = watch == null ? "" : String.format(" (%dms)", watch.elapsed(TimeUnit.MILLISECONDS));
+      logger.debug(String.format("%s%s:\n%s", description, time, plan));
+    }
   }
 
-  protected void log(final String description, final RelNode node, final Logger logger, Stopwatch
watch, boolean number) {
+  protected void logAndSetTextPlan(final String description, final Prel prel, final Logger
logger) {
+    final String plan = PrelSequencer.printWithIds(prel, SqlExplainLevel.ALL_ATTRIBUTES);
+    if (textPlan != null) {
+      textPlan.value = plan;
+    }
 
     if (logger.isDebugEnabled()) {
-      final String plan;
-      if (number && node instanceof Prel) {
-        plan = PrelSequencer.printWithIds((Prel) node, SqlExplainLevel.ALL_ATTRIBUTES);
-        if (textPlan != null) {
-          textPlan.value = plan;
-        }
-      } else {
-        plan = RelOptUtil.toString(node, SqlExplainLevel.ALL_ATTRIBUTES);
-      }
-
-      final String time = watch == null ? "" : String.format(" (%dms)", watch.elapsed(TimeUnit.MILLISECONDS));
-      logger.debug(String.format("%s%s:\n%s", description, time, plan));
+      logger.debug(String.format("%s:\n%s", description, plan));
     }
   }
 
@@ -175,6 +167,7 @@ public class DefaultSqlHandler extends AbstractSqlHandler {
 
     final DrillRel drel = convertToDrel(queryRelNode, validatedRowType);
     final Prel prel = convertToPrel(drel);
+    logAndSetTextPlan("Drill Physical", prel, logger);
     final PhysicalOperator pop = convertToPop(prel);
     final PhysicalPlan plan = convertToPlan(pop);
     log("Drill Plan", plan, logger);

http://git-wip-us.apache.org/repos/asf/drill/blob/2850a9fa/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ExplainHandler.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ExplainHandler.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ExplainHandler.java
index 98a14e5..62e44d8 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ExplainHandler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/ExplainHandler.java
@@ -65,6 +65,7 @@ public class ExplainHandler extends DefaultSqlHandler {
     }
 
     Prel prel = convertToPrel(drel);
+    logAndSetTextPlan("Drill Physical", prel, logger);
     PhysicalOperator pop = convertToPop(prel);
     PhysicalPlan plan = convertToPlan(pop);
     log("Drill Plan", plan, logger);


Mime
View raw message