Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 108EA200C39 for ; Thu, 16 Mar 2017 18:10:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0F44F160B78; Thu, 16 Mar 2017 17:10:01 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8FB44160B72 for ; Thu, 16 Mar 2017 18:09:59 +0100 (CET) Received: (qmail 78758 invoked by uid 500); 16 Mar 2017 17:09:57 -0000 Mailing-List: contact commits-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list commits@asterixdb.apache.org Received: (qmail 78749 invoked by uid 99); 16 Mar 2017 17:09:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Mar 2017 17:09:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9495BDFBC9; Thu, 16 Mar 2017 17:09:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mblow@apache.org To: commits@asterixdb.apache.org Message-Id: <3ada252939f94537b2b25b8efa325615@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: asterixdb git commit: Remove Plan Plotter Date: Thu, 16 Mar 2017 17:09:57 +0000 (UTC) archived-at: Thu, 16 Mar 2017 17:10:01 -0000 Repository: asterixdb Updated Branches: refs/heads/master 73441e8dc -> c19318f75 Remove Plan Plotter Change-Id: Ib6a77070344a40c3ae5bb9ff20b8593506d3c746 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1587 Reviewed-by: Yingyi Bu Sonar-Qube: Jenkins Tested-by: Jenkins Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/c19318f7 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/c19318f7 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/c19318f7 Branch: refs/heads/master Commit: c19318f75ec4c9a744d84be11738976a55a23310 Parents: 73441e8 Author: Michael Blow Authored: Thu Mar 16 11:44:18 2017 -0400 Committer: Michael Blow Committed: Thu Mar 16 10:09:34 2017 -0700 ---------------------------------------------------------------------- .../apache/asterix/api/common/APIFramework.java | 25 +--- .../resources/asterix-build-configuration.xml | 6 - .../resources/asterix-build-configuration2.xml | 6 - .../resources/asterix-build-configuration3.xml | 6 - .../resources/asterix-build-configuration4.xml | 6 - .../api/cluster_state_1/cluster_state_1.1.adm | 1 - .../cluster_state_1_full.1.adm | 1 - .../cluster_state_1_less.1.adm | 1 - .../common/config/ExternalProperties.java | 6 - .../asterix-doc/src/site/markdown/ncservice.md | 1 - .../resources/conf/asterix-configuration.xml | 7 - .../integrationts/asterix-configuration.xml | 7 - .../resources/base-asterix-configuration.xml | 7 - .../configs/base-asterix-configuration.xml | 7 - .../algebricks/algebricks-core/pom.xml | 4 - .../core/algebra/prettyprint/PlanPlotter.java | 143 ------------------- 16 files changed, 5 insertions(+), 229 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java ---------------------------------------------------------------------- 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.Map; 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.runtime.utils.AppContextInfo; 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.ICompiler; 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.algebricks.core.rewriter.base.PhysicalOptimizationConf 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 @@ public class APIFramework { } 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 querySpecificConfig = metadataProvider.getConfig(); @@ -249,10 +238,6 @@ public class APIFramework { 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. http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/main/resources/asterix-build-configuration.xml ---------------------------------------------------------------------- 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 @@ - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - messaging.frame.size 4096 The frame size to be used for NC to NC messaging. (Default = 4kb) http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/main/resources/asterix-build-configuration2.xml ---------------------------------------------------------------------- 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 @@ - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - messaging.frame.size 4096 The frame size to be used for NC to NC messaging. (Default = 4kb) http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/main/resources/asterix-build-configuration3.xml ---------------------------------------------------------------------- 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 @@ - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - messaging.frame.size 4096 The frame size to be used for NC to NC messaging. (Default = 4kb) http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/main/resources/asterix-build-configuration4.xml ---------------------------------------------------------------------- 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 @@ - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - messaging.frame.size 4096 The frame size to be used for NC to NC messaging. (Default = 4kb) http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.adm ---------------------------------------------------------------------- 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, http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.adm ---------------------------------------------------------------------- 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, http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.adm ---------------------------------------------------------------------- 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, http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java ---------------------------------------------------------------------- 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 @@ public class ExternalProperties extends AbstractProperties { 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 @@ public class ExternalProperties extends AbstractProperties { 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 @@ public class ExternalProperties extends AbstractProperties { 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); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-doc/src/site/markdown/ncservice.md ---------------------------------------------------------------------- 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 @@ The following parameters are configured under the "[common]" section. | 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) | http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-installer/src/main/resources/conf/asterix-configuration.xml ---------------------------------------------------------------------- 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 @@ - - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-installer/src/test/resources/integrationts/asterix-configuration.xml ---------------------------------------------------------------------- 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 @@ - - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-yarn/src/main/resources/base-asterix-configuration.xml ---------------------------------------------------------------------- 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 @@ - - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/asterixdb/asterix-yarn/src/main/resources/configs/base-asterix-configuration.xml ---------------------------------------------------------------------- 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 @@ - - plot.activate - false - Enabling plot of Algebricks plan to tmp folder. (Default = false) - - - http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/hyracks-fullstack/algebricks/algebricks-core/pom.xml ---------------------------------------------------------------------- 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 @@ ${project.version} - commons-io - commons-io - - org.apache.hyracks hyracks-dataflow-common ${project.version} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c19318f7/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/PlanPlotter.java ---------------------------------------------------------------------- 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 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 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 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(' '); - } - } -}