Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions conf/wayang-defaults.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# 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.
#

# Configure statistics collection.
wayang.core.log.enabled = true

wayang.core.explain.enabled = false
wayang.core.explain.directrory = ~/.wayang/
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.wayang.core.api.Configuration;
import org.apache.wayang.core.plugin.Plugin;
import org.apache.wayang.core.api.WayangContext;
import org.apache.wayang.core.util.ReflectionUtils;
import org.apache.wayang.core.plan.wayangplan.WayangPlan;
import org.apache.wayang.java.Java;
import org.apache.wayang.postgres.Postgres;
Expand Down Expand Up @@ -84,14 +85,14 @@ public SqlContext(final Configuration configuration, final List<Plugin> plugins)
for (final Plugin plugin : plugins) {
this.withPlugin(plugin);
}

calciteSchema = SchemaUtils.getSchema(configuration);
}

/**
* Entry point for executing SQL statements while providing arguments.
* You need to provide at least a JDBC source.
*
*
* @param args args[0] = SQL statement path, args[1] = JDBC driver, args[2] =
* JDBC URL, args[3] = JDBC user,
*              args[4] = JDBC password, args[5] = outputPath,
Expand Down Expand Up @@ -138,6 +139,7 @@ public static void main(final String[] args) throws Exception {
jdbcDriver, jdbcUrl, jdbcUser, jdbcPassword);

final Configuration configuration = new Configuration();
configuration.load(ReflectionUtils.loadResource("wayang-defaults.properties"));

configuration.setProperty("wayang.calcite.model", calciteModel);
configuration.setProperty(String.format("wayang.%s.jdbc.url", driverPlatform), jdbcUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,15 @@ protected void doExecute() {
}

if (this.configuration.getBooleanProperty("wayang.core.explain.enabled")) {
long unixTime = System.currentTimeMillis() / 1000L;

ExplainUtils.write(
ExplainUtils.parsePlan(this.wayangPlan, true),
this.configuration.getStringProperty("wayang.core.explain.logical.file")
this.configuration.getStringProperty("wayang.core.explain.directory") + "job-" + this.name + "-" + unixTime + "-logical.json"
);
ExplainUtils.write(
ExplainUtils.parsePlan(executionPlan, true),
this.configuration.getStringProperty("wayang.core.explain.execution.file")
this.configuration.getStringProperty("wayang.core.explain.directory") + "job-" + this.name + "-" + unixTime + "-execution.json"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@ public void explain(WayangPlan wayangPlan, String... udfJars) {
public void explain(WayangPlan wayangPlan, boolean toJson, String... udfJars) {
Job job = this.createJob(null, null, wayangPlan, udfJars);
ExecutionPlan executionPlan = job.buildInitialExecutionPlan();
long unixTime = System.currentTimeMillis() / 1000L;

ExplainUtils.write(
ExplainUtils.parsePlan(wayangPlan, true),
this.configuration.getStringProperty("wayang.core.explain.logical.file")
this.configuration.getStringProperty("wayang.core.explain.directory") + "job-" + job.getName() + "-" + unixTime + "-logical.json"
);
ExplainUtils.write(
ExplainUtils.parsePlan(executionPlan, true),
this.configuration.getStringProperty("wayang.core.explain.execution.file")
this.configuration.getStringProperty("wayang.core.explain.directory") + "job-" + job.getName() + "-" + unixTime + "-execution.json"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ wayang.core.log.enabled = true
# wayang.core.log.cardinalities = ~/.wayang/cardinalities.json
# wayang.core.log.executions = ~/.wayang/executions.json
wayang.core.explain.enabled = false
wayang.core.explain.directrory = ~/.wayang/

# Configure re-optimization.
wayang.core.optimizer.reoptimize = false
Expand Down
Loading