Remove Plan Plotter
Change-Id: Ib6a77070344a40c3ae5bb9ff20b8593506d3c746
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1587
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
index aec19e8..3e722cc 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
@@ -29,13 +29,12 @@
import java.util.Random;
import java.util.Set;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslator;
import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslatorFactory;
import org.apache.asterix.api.http.server.ResultUtil;
import org.apache.asterix.common.config.CompilerProperties;
-import org.apache.asterix.common.config.ExternalProperties;
import org.apache.asterix.common.config.OptimizationConfUtil;
-import org.apache.hyracks.control.common.config.OptionTypes;
import org.apache.asterix.common.exceptions.ACIDException;
import org.apache.asterix.common.exceptions.CompilationException;
import org.apache.asterix.common.utils.Job;
@@ -63,8 +62,8 @@
import org.apache.asterix.transaction.management.service.transaction.JobIdFactory;
import org.apache.asterix.translator.CompiledStatements.ICompiledDmlStatement;
import org.apache.asterix.translator.IStatementExecutor.Stats;
-import org.apache.asterix.utils.ResourceUtils;
import org.apache.asterix.translator.SessionConfig;
+import org.apache.asterix.utils.ResourceUtils;
import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -74,15 +73,14 @@
import org.apache.hyracks.algebricks.compiler.api.ICompilerFactory;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan;
import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import org.apache.hyracks.algebricks.core.algebra.expressions.ExpressionRuntimeProvider;
import org.apache.hyracks.algebricks.core.algebra.expressions.IConflictingTypeResolver;
import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionEvalSizeComputer;
import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionTypeComputer;
import org.apache.hyracks.algebricks.core.algebra.expressions.IMergeAggregationExpressionFactory;
import org.apache.hyracks.algebricks.core.algebra.expressions.IMissableTypeComputer;
-import org.apache.hyracks.algebricks.core.algebra.expressions.ExpressionRuntimeProvider;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.AlgebricksAppendable;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.LogicalOperatorPrettyPrintVisitor;
-import org.apache.hyracks.algebricks.core.algebra.prettyprint.PlanPlotter;
import org.apache.hyracks.algebricks.core.algebra.prettyprint.PlanPrettyPrinter;
import org.apache.hyracks.algebricks.core.rewriter.base.AlgebricksOptimizationContext;
import org.apache.hyracks.algebricks.core.rewriter.base.IOptimizationContextFactory;
@@ -90,12 +88,11 @@
import org.apache.hyracks.api.client.IClusterInfoCollector;
import org.apache.hyracks.api.client.IHyracksClientConnection;
import org.apache.hyracks.api.client.NodeControllerInfo;
+import org.apache.hyracks.api.config.IOptionType;
import org.apache.hyracks.api.exceptions.HyracksException;
import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.api.job.JobSpecification;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.hyracks.api.config.IOptionType;
+import org.apache.hyracks.control.common.config.OptionTypes;
/**
* Provides helper methods for compilation of a query into a JobSpec and submission
@@ -204,14 +201,6 @@
}
printPlanPostfix(conf);
}
-
- //print the plot for the logical plan
- ExternalProperties xProps = AppContextInfo.INSTANCE.getExternalProperties();
- Boolean plot = xProps.getIsPlottingEnabled();
- if (plot) {
- PlanPlotter.printLogicalPlan(plan);
- }
-
CompilerProperties compilerProperties = AppContextInfo.INSTANCE.getCompilerProperties();
int frameSize = compilerProperties.getFrameSize();
Map<String, String> querySpecificConfig = metadataProvider.getConfig();
@@ -249,10 +238,6 @@
ICompiler compiler = compilerFactory.createCompiler(plan, metadataProvider, t.getVarCounter());
if (conf.isOptimize()) {
compiler.optimize();
- //plot optimized logical plan
- if (plot) {
- PlanPlotter.printOptimizedLogicalPlan(plan);
- }
if (conf.is(SessionConfig.OOB_OPTIMIZED_LOGICAL_PLAN)) {
if (conf.is(SessionConfig.FORMAT_ONLY_PHYSICAL_OPS)) {
// For Optimizer tests.
diff --git a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration.xml b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration.xml
index 42cc42c..ce7eb3d 100644
--- a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration.xml
+++ b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration.xml
@@ -93,12 +93,6 @@
</description>
</property>
<property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
- <property>
<name>messaging.frame.size</name>
<value>4096</value>
<description>The frame size to be used for NC to NC messaging. (Default = 4kb)
diff --git a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration2.xml b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration2.xml
index 4418f49..af17901 100644
--- a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration2.xml
+++ b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration2.xml
@@ -97,12 +97,6 @@
</description>
</property>
<property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
- <property>
<name>messaging.frame.size</name>
<value>4096</value>
<description>The frame size to be used for NC to NC messaging. (Default = 4kb)
diff --git a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration3.xml b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration3.xml
index 4aa4a89..06ac7b5 100644
--- a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration3.xml
+++ b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration3.xml
@@ -97,12 +97,6 @@
</description>
</property>
<property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
- <property>
<name>messaging.frame.size</name>
<value>4096</value>
<description>The frame size to be used for NC to NC messaging. (Default = 4kb)
diff --git a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration4.xml b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration4.xml
index 4d97f71..bfa51dd 100644
--- a/asterixdb/asterix-app/src/main/resources/asterix-build-configuration4.xml
+++ b/asterixdb/asterix-app/src/main/resources/asterix-build-configuration4.xml
@@ -73,12 +73,6 @@
</description>
</property>
<property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
- <property>
<name>messaging.frame.size</name>
<value>4096</value>
<description>The frame size to be used for NC to NC messaging. (Default = 4kb)
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
index aebf817..251aeb6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm
@@ -20,7 +20,6 @@
"metadata.listen.port" : 0,
"metadata.node" : "asterix_nc1",
"metadata.registration.timeout.secs" : 60,
- "plot.activate" : false,
"replication.log.batchsize" : 4096,
"replication.log.buffer.numpages" : 8,
"replication.log.buffer.pagesize" : 131072,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
index 47ea9d6..485a983 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm
@@ -20,7 +20,6 @@
"metadata.listen.port" : 0,
"metadata.node" : "asterix_nc1",
"metadata.registration.timeout.secs" : 60,
- "plot.activate" : false,
"replication.log.batchsize" : 4096,
"replication.log.buffer.numpages" : 8,
"replication.log.buffer.pagesize" : 131072,
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
index b39ccd7..ec0ae4a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm
@@ -20,7 +20,6 @@
"metadata.listen.port" : 0,
"metadata.node" : "asterix_nc1",
"metadata.registration.timeout.secs" : 60,
- "plot.activate" : false,
"replication.log.batchsize" : 4096,
"replication.log.buffer.numpages" : 8,
"replication.log.buffer.pagesize" : 131072,
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
index 4ab1d97..bde8303 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java
@@ -34,7 +34,6 @@
LOG_LEVEL(LEVEL, java.util.logging.Level.WARNING, "The logging level for master and slave processes"),
MAX_WAIT_ACTIVE_CLUSTER(INTEGER, 60, "The max pending time (in seconds) for cluster startup. After the " +
"threshold, if the cluster still is not up and running, it is considered unavailable"),
- PLOT_ACTIVATE(BOOLEAN, false, null),
CC_JAVA_OPTS(STRING, "-Xmx1024m", "The JVM options passed to the cluster controller process by managix"),
NC_JAVA_OPTS(STRING, "-Xmx1024m", "The JVM options passed to the node controller process(es) by managix");
@@ -58,7 +57,6 @@
return Section.CC;
case LOG_LEVEL:
case MAX_WAIT_ACTIVE_CLUSTER:
- case PLOT_ACTIVATE:
return Section.COMMON;
case CC_JAVA_OPTS:
case NC_JAVA_OPTS:
@@ -112,10 +110,6 @@
return accessor.getInt(Option.MAX_WAIT_ACTIVE_CLUSTER);
}
- public boolean getIsPlottingEnabled() {
- return accessor.getBoolean(Option.PLOT_ACTIVATE);
- }
-
public String getNCJavaParams() {
return accessor.getString(Option.NC_JAVA_OPTS);
}
diff --git a/asterixdb/asterix-doc/src/site/markdown/ncservice.md b/asterixdb/asterix-doc/src/site/markdown/ncservice.md
index cd19db6..aadecc2 100644
--- a/asterixdb/asterix-doc/src/site/markdown/ncservice.md
+++ b/asterixdb/asterix-doc/src/site/markdown/ncservice.md
@@ -354,7 +354,6 @@
| common | metadata.listen.port | IP port to bind metadata listener (0 = random port) | 0 |
| common | metadata.node | the node which should serve as the metadata node | <undefined> |
| common | metadata.registration.timeout.secs | how long in seconds to wait for the metadata node to register with the CC | 60 |
-| common | plot.activate | N/A | false |
| common | replication.log.batchsize | The size in bytes to replicate in each batch | 4096 (4 kB) |
| common | replication.log.buffer.numpages | The number of log buffer pages | 8 |
| common | replication.log.buffer.pagesize | The size in bytes of each log buffer page | 131072 (128 kB) |
diff --git a/asterixdb/asterix-installer/src/main/resources/conf/asterix-configuration.xml b/asterixdb/asterix-installer/src/main/resources/conf/asterix-configuration.xml
index ed8e70a..35d114e 100644
--- a/asterixdb/asterix-installer/src/main/resources/conf/asterix-configuration.xml
+++ b/asterixdb/asterix-installer/src/main/resources/conf/asterix-configuration.xml
@@ -265,11 +265,4 @@
</description>
</property>
- <property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
-
</asterixConfiguration>
diff --git a/asterixdb/asterix-installer/src/test/resources/integrationts/asterix-configuration.xml b/asterixdb/asterix-installer/src/test/resources/integrationts/asterix-configuration.xml
index a5ecc6b..9583485 100644
--- a/asterixdb/asterix-installer/src/test/resources/integrationts/asterix-configuration.xml
+++ b/asterixdb/asterix-installer/src/test/resources/integrationts/asterix-configuration.xml
@@ -258,11 +258,4 @@
</description>
</property>
- <property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
-
</asterixConfiguration>
diff --git a/asterixdb/asterix-yarn/src/main/resources/base-asterix-configuration.xml b/asterixdb/asterix-yarn/src/main/resources/base-asterix-configuration.xml
index a1b369e..17d88ae 100644
--- a/asterixdb/asterix-yarn/src/main/resources/base-asterix-configuration.xml
+++ b/asterixdb/asterix-yarn/src/main/resources/base-asterix-configuration.xml
@@ -250,11 +250,4 @@
</description>
</property>
- <property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
-
</asterixConfiguration>
diff --git a/asterixdb/asterix-yarn/src/main/resources/configs/base-asterix-configuration.xml b/asterixdb/asterix-yarn/src/main/resources/configs/base-asterix-configuration.xml
index a1b369e..17d88ae 100644
--- a/asterixdb/asterix-yarn/src/main/resources/configs/base-asterix-configuration.xml
+++ b/asterixdb/asterix-yarn/src/main/resources/configs/base-asterix-configuration.xml
@@ -250,11 +250,4 @@
</description>
</property>
- <property>
- <name>plot.activate</name>
- <value>false</value>
- <description>Enabling plot of Algebricks plan to tmp folder. (Default = false)
- </description>
- </property>
-
</asterixConfiguration>
diff --git a/hyracks-fullstack/algebricks/algebricks-core/pom.xml b/hyracks-fullstack/algebricks/algebricks-core/pom.xml
index 5af7208..8621eb9 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/pom.xml
+++ b/hyracks-fullstack/algebricks/algebricks-core/pom.xml
@@ -58,10 +58,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.hyracks</groupId>
<artifactId>hyracks-dataflow-common</artifactId>
<version>${project.version}</version>
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java
deleted file mode 100644
index 7b98ebd..0000000
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.algebricks.core.algebra.prettyprint;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Random;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.mutable.Mutable;
-
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
-import org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan;
-import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
-
-public class PlanPlotter {
-
- static Random randomGenerator = new Random();
-
- public static void printLogicalPlan(ILogicalPlan plan) throws AlgebricksException {
- int indent = 5;
- StringBuilder out = new StringBuilder();
- int randomInt = 10000 + randomGenerator.nextInt(100);
- appendln(out, "digraph G {");
- for (Mutable<ILogicalOperator> root : plan.getRoots()) {
- printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt);
- }
- appendln(out, "\n}\n}");
- try {
- File file = File.createTempFile("logicalPlan", ".txt");
- FileUtils.writeStringToFile(file, out.toString());
- file.deleteOnExit();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static void printOptimizedLogicalPlan(ILogicalPlan plan) throws AlgebricksException {
- int indent = 5;
- StringBuilder out = new StringBuilder();
- int randomInt = 10000 + randomGenerator.nextInt(100);
- appendln(out, "digraph G {");
- for (Mutable<ILogicalOperator> root : plan.getRoots()) {
- printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt);
- }
- appendln(out, "\n}\n}");
- try {
- File file = File.createTempFile("logicalOptimizedPlan", ".txt");
- FileUtils.writeStringToFile(file, out.toString());
- file.deleteOnExit();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- /*
- * DFS traversal function. Calls iteratively all children, and for each calls itself recursively
- * Includes slim-maps only (no gathering of mappers to one)
- */
- public static void printVisualizationGraph(AbstractLogicalOperator op, int indent, StringBuilder out,
- String current_supernode_name, int randomInt) {
- if (!op.getInputs().isEmpty()) {
- //String stringToVisualize = op.toStringForVisualizationGraph();
- String stringToVisualize = op.getOperatorTag().name();
- int firstOccurenceOf_ = stringToVisualize.indexOf("_");
- String supernode_current = stringToVisualize.substring(firstOccurenceOf_ + 1, stringToVisualize.length());
- if (current_supernode_name.isEmpty()) {
- current_supernode_name = supernode_current;
- appendln(out, new String("subgraph cluster_" + supernode_current + " {"));
- pad(out, indent);
- appendln(out, new String("node [style=filled, color = lightgray];"));
- pad(out, indent);
- appendln(out, new String("color=blue;"));
- pad(out, indent);
- String op_id = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
- appendln(out, new String("label = \"" + supernode_current + "ID" + op_id + "\";"));
- pad(out, indent);
- }
-
- for (Mutable<ILogicalOperator> i : op.getInputs()) {
- String op_id = i.toString().substring(i.toString().indexOf("@") + 1, i.toString().length());
- String logOpStr = ((AbstractLogicalOperator) i.getValue()).getOperatorTag().name() + "ID" + op_id;
- firstOccurenceOf_ = logOpStr.indexOf("_");
- String supernode_child = logOpStr.substring(firstOccurenceOf_ + 1, logOpStr.length());
- if (!supernode_current.equals(supernode_child)) {
- appendln(out, new String("node [style=filled, color = lightgray];"));
- pad(out, indent);
- appendln(out, new String("color=blue"));
- pad(out, indent);
- appendln(out, new String("label = \"" + supernode_child + "\";"));
- pad(out, indent);
- }
-
- op_id = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
- appendln(out, stringToVisualize + "ID" + op_id + "[style = filled]");
- AbstractLogicalOperator child = (AbstractLogicalOperator) i.getValue();
-
- pad(out, indent);
- String op_id1 = op.toString().substring(op.toString().indexOf("@") + 1, op.toString().length());
- append(out, op.getOperatorTag().name() + "ID" + op_id1 + " -> ");
- String opc_id = child.toString()
- .substring(child.toString().indexOf("@") + 1, child.toString().length());
- appendln(out, child.getOperatorTag().name() + "ID" + opc_id);
-
- printVisualizationGraph(child, indent, out, supernode_current, (randomGenerator.nextInt(100) + 10000));
-
- }
- }
-
- }
-
- private static void appendln(StringBuilder buf, String s) {
- buf.append(s);
- buf.append("\n");
- }
-
- private static void append(StringBuilder buf, String s) {
- buf.append(s);
- }
-
- private static void pad(StringBuilder buf, int indent) {
- for (int i = 0; i < indent; ++i) {
- buf.append(' ');
- }
- }
-}