You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ch...@apache.org on 2013/09/21 01:29:18 UTC
svn commit: r1525177 - in /pig/branches/tez: ./ ivy/ src/META-INF/services/
src/org/apache/pig/backend/hadoop/executionengine/tez/
Author: cheolsoo
Date: Fri Sep 20 23:29:17 2013
New Revision: 1525177
URL: http://svn.apache.org/r1525177
Log:
PIG-3448: Tez backend layout (cheolsoo)
Added:
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/DagUtils.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/MapOper.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/ReduceOper.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezCompiler.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecType.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJob.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJobControlCompiler.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezLauncher.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOpPlanVisitor.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperPlan.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperator.java
pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezPrinter.java
Modified:
pig/branches/tez/build.xml
pig/branches/tez/ivy.xml
pig/branches/tez/ivy/libraries.properties
pig/branches/tez/src/META-INF/services/org.apache.pig.ExecType
Modified: pig/branches/tez/build.xml
URL: http://svn.apache.org/viewvc/pig/branches/tez/build.xml?rev=1525177&r1=1525176&r2=1525177&view=diff
==============================================================================
--- pig/branches/tez/build.xml (original)
+++ pig/branches/tez/build.xml Fri Sep 20 23:29:17 2013
@@ -169,11 +169,8 @@
<property name="ivy.dir" location="ivy" />
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
- <!--propertyregex property="hadoopversion"
- input="${hadoop-core.version}"
- regexp="\d+\.(\d+)\.\d+"
- select="\1" /-->
- <property name="hadoopversion" value="20" />
+ <!-- Set default hadoop version to 23 in tez branch -->
+ <property name="hadoopversion" value="23" />
<condition property="isHadoop23">
<equals arg1="${hadoopversion}" arg2="23"/>
@@ -190,6 +187,13 @@
-->
<property name="hbaseversion" value="94" />
+ <!-- exclude tez code if not hadoop20 -->
+ <condition property="src.exclude.dir" value="**/tez/**" else="">
+ <not>
+ <equals arg1="${hadoopversion}" arg2="23"/>
+ </not>
+ </condition>
+
<property name="src.shims.dir" value="${basedir}/shims/src/hadoop${hadoopversion}" />
<property name="src.shims.test.dir" value="${basedir}/shims/test/hadoop${hadoopversion}" />
@@ -537,7 +541,7 @@
<echo>*** To compile with all warnings enabled, supply -Dall.warnings=1 on command line ***</echo>
<echo>*** Else, you will only be warned about deprecations ***</echo>
<compileSources sources="${src.dir};${src.gen.dir};${src.lib.dir}/shock;${src.lib.dir}/bzip2;${src.shims.dir}"
- excludes="" dist="${build.classes}" cp="classpath" warnings="${javac.args.warnings}" />
+ excludes="${src.exclude.dir}" dist="${build.classes}" cp="classpath" warnings="${javac.args.warnings}" />
<copy todir="${build.classes}/META-INF">
<fileset dir="${src.dir}/META-INF" includes="**"/>
</copy>
@@ -838,7 +842,7 @@
<mkdir dir="${test.log.dir}"/>
<tempfile property="junit.tmp.dir" prefix="pig_junit_tmp" destDir="${java.io.tmpdir}" />
<mkdir dir="${junit.tmp.dir}/"/>
- <junit showoutput="${test.output}" printsummary="yes" haltonfailure="no" fork="yes" maxmemory="1024m" dir="${basedir}" timeout="${test.timeout}" errorProperty="tests.failed" failureProperty="tests.failed">
+ <junit showoutput="${test.output}" printsummary="yes" haltonfailure="no" fork="yes" maxmemory="2048m" dir="${basedir}" timeout="${test.timeout}" errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="ssh.gateway" value="${ssh.gateway}" />
<sysproperty key="hod.server" value="${hod.server}" />
<sysproperty key="java.io.tmpdir" value="${junit.tmp.dir}" />
Modified: pig/branches/tez/ivy.xml
URL: http://svn.apache.org/viewvc/pig/branches/tez/ivy.xml?rev=1525177&r1=1525176&r2=1525177&view=diff
==============================================================================
--- pig/branches/tez/ivy.xml (original)
+++ pig/branches/tez/ivy.xml Fri Sep 20 23:29:17 2013
@@ -358,6 +358,34 @@
</dependency>
<dependency org="org.mockito" name="mockito-all" rev="${mockito.version}" conf="compile->default"/>
- </dependencies>
+
+ <!-- for Tez integration -->
+ <dependency org="org.apache.tez" name="tez" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-common" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-dag" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-dag-api" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-dist" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-engine" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-engine-api" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ <dependency org="org.apache.tez" name="tez-mapreduce" rev="${tez.version}"
+ conf="hadoop23->master">
+ <artifact name="tez-mapreduce" ext="jar" />
+ <artifact name="tez-mapreduce" type="tests" ext="jar" m:classifier="tests" />
+ </dependency>
+ <dependency org="org.apache.tez" name="tez-mapreduce-tests" rev="${tez.version}"
+ conf="hadoop23->master">
+ <artifact name="tez-mapreduce-tests" ext="jar" />
+ <artifact name="tez-mapreduce-tests" type="tests" ext="jar" m:classifier="tests" />
+ </dependency>
+ <dependency org="org.apache.tez" name="tez-yarn-client" rev="${tez.version}"
+ conf="hadoop23->master"/>
+ </dependencies>
</ivy-module>
Modified: pig/branches/tez/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/pig/branches/tez/ivy/libraries.properties?rev=1525177&r1=1525176&r2=1525177&view=diff
==============================================================================
--- pig/branches/tez/ivy/libraries.properties (original)
+++ pig/branches/tez/ivy/libraries.properties Fri Sep 20 23:29:17 2013
@@ -38,9 +38,9 @@ guava.version=11.0
jersey-core.version=1.8
hadoop-core.version=1.0.0
hadoop-test.version=1.0.0
-hadoop-common.version=2.0.3-alpha
-hadoop-hdfs.version=2.0.3-alpha
-hadoop-mapreduce.version=2.0.3-alpha
+hadoop-common.version=2.1.0-beta
+hadoop-hdfs.version=2.1.0-beta
+hadoop-mapreduce.version=2.1.0-beta
hbase94.version=0.94.1
hbase95.version=0.95.3-hadoop1-SNAPSHOT
hsqldb.version=1.8.0.10
@@ -77,7 +77,7 @@ wagon-http.version=1.0-beta-2
zookeeper.version=3.4.4
servlet.version=4.0.6
servlet-api.version=2.5
-protobuf-java.version=2.4.0a
+protobuf-java.version=2.5.0
high-scale-lib.version=1.1.1
metrics-core.version=2.1.2
guice.version=3.0
@@ -88,3 +88,4 @@ mockito.version=1.8.4
jansi.version=1.9
asm.version=3.3.1
snappy.version=1.0.5-M3
+tez.version=0.2.0-SNAPSHOT
Modified: pig/branches/tez/src/META-INF/services/org.apache.pig.ExecType
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/META-INF/services/org.apache.pig.ExecType?rev=1525177&r1=1525176&r2=1525177&view=diff
==============================================================================
--- pig/branches/tez/src/META-INF/services/org.apache.pig.ExecType (original)
+++ pig/branches/tez/src/META-INF/services/org.apache.pig.ExecType Fri Sep 20 23:29:17 2013
@@ -13,4 +13,4 @@
#
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.LocalExecType
org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MRExecType
-
+org.apache.pig.backend.hadoop.executionengine.tez.TezExecType
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/DagUtils.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/DagUtils.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/DagUtils.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/DagUtils.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,68 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.io.IOException;
+
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.tez.dag.api.Edge;
+import org.apache.tez.dag.api.EdgeProperty;
+import org.apache.tez.dag.api.EdgeProperty.DataMovementType;
+import org.apache.tez.dag.api.EdgeProperty.DataSourceType;
+import org.apache.tez.dag.api.EdgeProperty.SchedulingType;
+import org.apache.tez.dag.api.InputDescriptor;
+import org.apache.tez.dag.api.OutputDescriptor;
+import org.apache.tez.dag.api.Vertex;
+import org.apache.tez.engine.lib.input.ShuffledMergedInput;
+import org.apache.tez.engine.lib.output.OnFileSortedOutput;
+import org.apache.tez.mapreduce.hadoop.MRHelpers;
+import org.apache.tez.mapreduce.hadoop.MultiStageMRConfToTezTranslator;
+
+public class DagUtils {
+
+ /**
+ * Given two vertices and their respective configuration objects createEdge
+ * will create an Edge object that connects the two. Currently the edge will
+ * always be a stable bi-partite edge.
+ *
+ * @param vConf JobConf of the first vertex
+ * @param v The first vertex (source)
+ * @param wConf JobConf of the second vertex
+ * @param w The second vertex (sink)
+ * @return
+ */
+ public static Edge createEdge(JobConf vConf, Vertex v, JobConf wConf, Vertex w) throws IOException {
+
+ // Tez needs to setup output subsequent input pairs correctly
+ MultiStageMRConfToTezTranslator.translateVertexConfToTez(wConf, vConf);
+
+ // update payloads (configuration for the vertices might have changed)
+ v.getProcessorDescriptor().setUserPayload(MRHelpers.createUserPayloadFromConf(vConf));
+ w.getProcessorDescriptor().setUserPayload(MRHelpers.createUserPayloadFromConf(wConf));
+
+ // all edges are of the same type right now
+ EdgeProperty edgeProperty =
+ new EdgeProperty(
+ DataMovementType.SCATTER_GATHER,
+ DataSourceType.PERSISTED,
+ SchedulingType.SEQUENTIAL,
+ new OutputDescriptor(OnFileSortedOutput.class.getName()),
+ new InputDescriptor(ShuffledMergedInput.class.getName()));
+ return new Edge(v, w, edgeProperty);
+ }
+}
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/MapOper.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/MapOper.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/MapOper.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/MapOper.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,49 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.util.Map;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.yarn.api.records.LocalResource;
+import org.apache.pig.impl.plan.OperatorKey;
+import org.apache.tez.dag.api.Vertex;
+import org.apache.tez.mapreduce.processor.map.MapProcessor;
+
+public class MapOper extends TezOperator {
+
+ private static final long serialVersionUID = 1L;
+
+ public MapOper(OperatorKey k) {
+ super(k);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public String getProcessorName() {
+ return MapProcessor.class.getName();
+ }
+
+ @Override
+ public void configureVertex(Vertex operVertex, Configuration operConf,
+ Map<String, LocalResource> commonLocalResources, Path remoteStagingDir) {
+ // TODO Auto-generated method stub
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/ReduceOper.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/ReduceOper.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/ReduceOper.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/ReduceOper.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,50 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.util.Map;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.yarn.api.records.LocalResource;
+import org.apache.pig.impl.plan.OperatorKey;
+import org.apache.tez.dag.api.Vertex;
+import org.apache.tez.mapreduce.processor.reduce.ReduceProcessor;
+
+public class ReduceOper extends TezOperator {
+
+ private static final long serialVersionUID = 1L;
+
+ public ReduceOper(OperatorKey k) {
+ super(k);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public String getProcessorName() {
+ return ReduceProcessor.class.getName();
+ }
+
+ @Override
+ public void configureVertex(Vertex operVertex, Configuration operConf,
+ Map<String, LocalResource> commonLocalResources,
+ Path remoteStagingDir) {
+ // TODO Auto-generated method stub
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezCompiler.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezCompiler.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezCompiler.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezCompiler.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,53 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.io.IOException;
+
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhyPlanVisitor;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.impl.plan.PlanException;
+import org.apache.pig.impl.plan.PlanWalker;
+import org.apache.pig.impl.plan.VisitorException;
+
+/**
+ * The compiler that compiles a given physical plan into a DAG of Tez
+ * operators which can then be converted into the JobControl structure.
+ */
+public class TezCompiler extends PhyPlanVisitor {
+
+ public TezCompiler(PhysicalPlan plan,
+ PlanWalker<PhysicalOperator, PhysicalPlan> walker) {
+ super(plan, walker);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * The front-end method that the user calls to compile the plan. Assumes
+ * that all submitted plans have a Store operators as the leaf.
+ * @return A Tez plan
+ * @throws IOException
+ * @throws PlanException
+ * @throws VisitorException
+ */
+ public TezOperPlan compile() throws IOException, PlanException, VisitorException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecType.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecType.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecType.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecType.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,70 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.util.Properties;
+
+import org.apache.pig.ExecType;
+import org.apache.pig.backend.executionengine.ExecutionEngine;
+import org.apache.pig.impl.PigContext;
+
+/**
+ * TezExecType is the ExecType for distributed mode in Tez.
+ */
+public class TezExecType implements ExecType {
+
+ private static final long serialVersionUID = 1L;
+ private static final String[] modes = { "TEZ" };
+
+ @Override
+ public boolean accepts(Properties properties) {
+ String execTypeSpecified =
+ properties.getProperty("exectype", "").toUpperCase();
+ for (String mode : modes) {
+ if (execTypeSpecified.equals(mode)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public ExecutionEngine getExecutionEngine(PigContext pigContext) {
+ return new TezExecutionEngine(pigContext);
+ }
+
+ @Override
+ public Class<? extends ExecutionEngine> getExecutionEngineClass() {
+ return TezExecutionEngine.class;
+ }
+
+ @Override
+ public boolean isLocal() {
+ return false;
+ }
+
+ @Override
+ public String name() {
+ return "TEZ";
+ }
+
+ public String toString() {
+ return name();
+ }
+}
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezExecutionEngine.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,36 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import org.apache.pig.backend.hadoop.executionengine.HExecutionEngine;
+import org.apache.pig.impl.PigContext;
+import org.apache.pig.tools.pigstats.ScriptState;
+
+public class TezExecutionEngine extends HExecutionEngine {
+
+ public TezExecutionEngine(PigContext pigContext) {
+ super(pigContext);
+ this.launcher = new TezLauncher();
+ }
+
+ public ScriptState instantiateScriptState() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJob.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJob.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJob.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJob.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,36 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.io.IOException;
+
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.jobcontrol.Job;
+
+/**
+ * This class encapsulates all the operator objects that can be executed in a
+ * single Tez job.
+ */
+public class TezJob extends Job {
+
+ public TezJob(JobConf conf) throws IOException {
+ super(conf);
+ // TODO Auto-generated constructor stub
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJobControlCompiler.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJobControlCompiler.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJobControlCompiler.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezJobControlCompiler.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,35 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl;
+import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobCreationException;
+
+/**
+ * This is compiler class that takes a TezOperPlan and converts it into a
+ * JobControl object with the relevant dependency info maintained. The
+ * JobControl object is made up of TezJobs each of which which has a JobConf.
+ */
+public class TezJobControlCompiler {
+
+ public JobControl compile(TezOperPlan plan, String grpName) throws JobCreationException {
+ // TODO Auto-generated constructor stub
+ return null;
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezLauncher.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezLauncher.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezLauncher.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezLauncher.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,61 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.hadoop.mapred.JobConf;
+import org.apache.pig.backend.BackendException;
+import org.apache.pig.backend.hadoop.executionengine.Launcher;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.impl.PigContext;
+import org.apache.pig.impl.plan.PlanException;
+import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.tools.pigstats.PigStats;
+
+/**
+ * Main class that launches pig for Tez
+ */
+public class TezLauncher extends Launcher {
+
+ @Override
+ public PigStats launchPig(PhysicalPlan php, String grpName, PigContext pc)
+ throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void explain(PhysicalPlan pp, PigContext pc, PrintStream ps,
+ String format, boolean verbose) throws PlanException,
+ VisitorException, IOException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void kill() throws BackendException {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void killJob(String jobID, JobConf jobConf) throws BackendException {
+ // TODO Auto-generated method stub
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOpPlanVisitor.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOpPlanVisitor.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOpPlanVisitor.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOpPlanVisitor.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,40 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import org.apache.pig.impl.plan.PlanWalker;
+import org.apache.pig.impl.plan.VisitorException;
+import org.apache.pig.impl.plan.PlanVisitor;
+
+import org.apache.pig.backend.hadoop.executionengine.tez.TezOperPlan;
+
+/**
+ * A visitor for the TezOperPlan class
+ */
+public class TezOpPlanVisitor extends PlanVisitor<TezOperator, TezOperPlan> {
+
+ public TezOpPlanVisitor(TezOperPlan plan, PlanWalker<TezOperator, TezOperPlan> walker) {
+ super(plan, walker);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void visitTezOp(TezOperator tezOperator) throws VisitorException {
+ // TODO Auto-generated method stub
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperPlan.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperPlan.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperPlan.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperPlan.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,53 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import org.apache.pig.impl.plan.OperatorPlan;
+import org.apache.pig.impl.plan.VisitorException;
+
+/**
+ * A Plan used to create the plan of Tez operators which can be converted into
+ * the Job Control object. This is necessary to capture the dependencies among
+ * jobs.
+ */
+public class TezOperPlan extends OperatorPlan<TezOperator> {
+
+ private static final long serialVersionUID = 1L;
+
+ public TezOperPlan() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public String toString() {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(baos);
+ TezPrinter printer = new TezPrinter(ps, this);
+ printer.setVerbose(true);
+ try {
+ printer.visit();
+ } catch (VisitorException e) {
+ // TODO Auto-generated catch block
+ }
+ return baos.toString();
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperator.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperator.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperator.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezOperator.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,70 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.util.Map;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.yarn.api.records.LocalResource;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.impl.plan.Operator;
+import org.apache.pig.impl.plan.OperatorKey;
+import org.apache.pig.impl.plan.VisitorException;
+import org.apache.tez.dag.api.Vertex;
+
+/**
+ * An operator model for a Tez job. Acts as a host to the plans that will
+ * execute in Tez vertices.
+ */
+public abstract class TezOperator extends Operator<TezOpPlanVisitor> {
+
+ private static final long serialVersionUID = 1L;
+ private PhysicalPlan plan;
+
+ public TezOperator(OperatorKey k) {
+ super(k);
+ // TODO Auto-generated constructor stub
+ }
+
+ public abstract String getProcessorName();
+
+ public abstract void configureVertex(Vertex operVertex, Configuration operConf,
+ Map<String, LocalResource> commonLocalResources, Path remoteStagingDir);
+
+ public void visit(TezOpPlanVisitor v) throws VisitorException {
+ v.visitTezOp(this);
+ }
+
+ public boolean supportsMultipleInputs() {
+ return true;
+ }
+
+ public boolean supportsMultipleOutputs() {
+ return true;
+ }
+
+ public PhysicalPlan getPlan() {
+ return plan;
+ }
+
+ public String name() {
+ return "Tez - " + mKey.toString();
+ }
+}
+
Added: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezPrinter.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezPrinter.java?rev=1525177&view=auto
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezPrinter.java (added)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/tez/TezPrinter.java Fri Sep 20 23:29:17 2013
@@ -0,0 +1,76 @@
+/**
+ * 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.pig.backend.hadoop.executionengine.tez;
+
+import java.io.PrintStream;
+
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.PhysicalOperator;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PlanPrinter;
+import org.apache.pig.impl.plan.DepthFirstWalker;
+import org.apache.pig.impl.plan.VisitorException;
+
+/**
+ * A visitor to print out the Tez plan.
+ */
+public class TezPrinter extends TezOpPlanVisitor {
+
+ private PrintStream mStream = null;
+ private boolean isVerbose = true;
+
+ /**
+ * @param ps PrintStream to output plan information to
+ * @param plan tez plan to print
+ */
+ public TezPrinter(PrintStream ps, TezOperPlan plan) {
+ super(plan, new DepthFirstWalker<TezOperator, TezOperPlan>(plan));
+ mStream = ps;
+ mStream.println("#--------------------------------------------------");
+ mStream.println("# TEZ DAG ");
+ mStream.println("#--------------------------------------------------");
+ }
+
+ public void setVerbose(boolean verbose) {
+ isVerbose = verbose;
+ }
+
+ @Override
+ public void visitTezOp(TezOperator tezOper) throws VisitorException {
+ mStream.println("Tez Vertex " + tezOper.getOperatorKey().toString());
+
+ if (tezOper instanceof MapOper) {
+ mStream.println("Map Operator");
+ PlanPrinter<PhysicalOperator, PhysicalPlan> printer =
+ new PlanPrinter<PhysicalOperator, PhysicalPlan>(tezOper.getPlan(), mStream);
+ printer.setVerbose(isVerbose);
+ printer.visit();
+ mStream.println("--------");
+ } else if (tezOper instanceof ReduceOper) {
+ mStream.println("Reduce Operator");
+ PlanPrinter<PhysicalOperator, PhysicalPlan> printer =
+ new PlanPrinter<PhysicalOperator, PhysicalPlan>(tezOper.getPlan(), mStream);
+ printer.setVerbose(isVerbose);
+ printer.visit();
+ mStream.println("--------");
+ }
+
+ mStream.println("----------------");
+ mStream.println("");
+ }
+}
+