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/10/04 01:24:43 UTC

svn commit: r1529033 [1/3] - in /pig/branches/tez: ./ conf/ shims/src/hadoop20/org/apache/pig/backend/hadoop/executionengine/shims/ shims/src/hadoop23/org/apache/pig/backend/hadoop/executionengine/shims/ src/ src/docs/src/documentation/content/xdocs/ s...

Author: cheolsoo
Date: Thu Oct  3 23:24:40 2013
New Revision: 1529033

URL: http://svn.apache.org/r1529033
Log:
Merged latest trunk changes to tez branch

Added:
    pig/branches/tez/src/org/apache/pig/builtin/DateTimeMax.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/builtin/DateTimeMax.java
    pig/branches/tez/src/org/apache/pig/builtin/DateTimeMin.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/builtin/DateTimeMin.java
    pig/branches/tez/src/org/apache/pig/impl/builtin/StreamingUDF.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/builtin/StreamingUDF.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/PigStreamingUDF.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/PigStreamingUDF.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/StreamingDelimiters.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/StreamingDelimiters.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/StreamingUDFException.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/StreamingUDFException.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/StreamingUDFInputHandler.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/StreamingUDFInputHandler.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/StreamingUDFOutputHandler.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/StreamingUDFOutputHandler.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/StreamingUDFOutputSchemaException.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/StreamingUDFOutputSchemaException.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/StreamingUtil.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/impl/streaming/StreamingUtil.java
    pig/branches/tez/src/org/apache/pig/newplan/FilterExtractor.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/newplan/FilterExtractor.java
    pig/branches/tez/src/org/apache/pig/scripting/ScriptingOutputCapturer.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/scripting/ScriptingOutputCapturer.java
    pig/branches/tez/src/org/apache/pig/scripting/streaming/
      - copied from r1529032, pig/trunk/src/org/apache/pig/scripting/streaming/
    pig/branches/tez/src/org/apache/pig/scripting/streaming/python/
      - copied from r1529032, pig/trunk/src/org/apache/pig/scripting/streaming/python/
    pig/branches/tez/src/org/apache/pig/scripting/streaming/python/PythonScriptEngine.java
      - copied unchanged from r1529032, pig/trunk/src/org/apache/pig/scripting/streaming/python/PythonScriptEngine.java
    pig/branches/tez/src/python/
      - copied from r1529032, pig/trunk/src/python/
    pig/branches/tez/src/python/streaming/
      - copied from r1529032, pig/trunk/src/python/streaming/
    pig/branches/tez/src/python/streaming/controller.py
      - copied unchanged from r1529032, pig/trunk/src/python/streaming/controller.py
    pig/branches/tez/src/python/streaming/pig_util.py
      - copied unchanged from r1529032, pig/trunk/src/python/streaming/pig_util.py
    pig/branches/tez/test/data/pigunit/top_queries_macro.pig
      - copied unchanged from r1529032, pig/trunk/test/data/pigunit/top_queries_macro.pig
    pig/branches/tez/test/e2e/pig/conf/rpm.conf
      - copied unchanged from r1529032, pig/trunk/test/e2e/pig/conf/rpm.conf
    pig/branches/tez/test/e2e/pig/udfs/cpython/
      - copied from r1529032, pig/trunk/test/e2e/pig/udfs/cpython/
    pig/branches/tez/test/e2e/pig/udfs/cpython/morepythonudfs.py
      - copied unchanged from r1529032, pig/trunk/test/e2e/pig/udfs/cpython/morepythonudfs.py
    pig/branches/tez/test/e2e/pig/udfs/cpython/scriptingudf.py
      - copied unchanged from r1529032, pig/trunk/test/e2e/pig/udfs/cpython/scriptingudf.py
    pig/branches/tez/test/org/apache/pig/impl/builtin/
      - copied from r1529032, pig/trunk/test/org/apache/pig/impl/builtin/
    pig/branches/tez/test/org/apache/pig/impl/builtin/TestStreamingUDF.java
      - copied unchanged from r1529032, pig/trunk/test/org/apache/pig/impl/builtin/TestStreamingUDF.java
    pig/branches/tez/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java
      - copied unchanged from r1529032, pig/trunk/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java
    pig/branches/tez/test/org/apache/pig/impl/streaming/TestStreamingUDFOutputHandler.java
      - copied unchanged from r1529032, pig/trunk/test/org/apache/pig/impl/streaming/TestStreamingUDFOutputHandler.java
    pig/branches/tez/test/org/apache/pig/impl/streaming/TestStreamingUtil.java
      - copied unchanged from r1529032, pig/trunk/test/org/apache/pig/impl/streaming/TestStreamingUtil.java
    pig/branches/tez/test/org/apache/pig/test/TestNewPartitionFilterPushDown.java
      - copied unchanged from r1529032, pig/trunk/test/org/apache/pig/test/TestNewPartitionFilterPushDown.java
    pig/branches/tez/test/org/apache/pig/test/TestPigStreaming.java
      - copied unchanged from r1529032, pig/trunk/test/org/apache/pig/test/TestPigStreaming.java
    pig/branches/tez/test/perf/pigmix/lib/
      - copied from r1529032, pig/trunk/test/perf/pigmix/lib/
    pig/branches/tez/test/perf/pigmix/lib/sdsuLibJKD12.jar
      - copied unchanged from r1529032, pig/trunk/test/perf/pigmix/lib/sdsuLibJKD12.jar
    pig/branches/tez/test/python/
      - copied from r1529032, pig/trunk/test/python/
    pig/branches/tez/test/python/streaming/
      - copied from r1529032, pig/trunk/test/python/streaming/
    pig/branches/tez/test/python/streaming/test_controller.py
      - copied unchanged from r1529032, pig/trunk/test/python/streaming/test_controller.py
Removed:
    pig/branches/tez/test/org/apache/pig/impl/streaming/TestExecutableManager.java
Modified:
    pig/branches/tez/   (props changed)
    pig/branches/tez/CHANGES.txt
    pig/branches/tez/build.xml
    pig/branches/tez/conf/pig.properties
    pig/branches/tez/shims/src/hadoop20/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java
    pig/branches/tez/shims/src/hadoop23/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java
    pig/branches/tez/src/docs/src/documentation/content/xdocs/basic.xml
    pig/branches/tez/src/docs/src/documentation/content/xdocs/tabs.xml
    pig/branches/tez/src/org/apache/pig/LoadCaster.java
    pig/branches/tez/src/org/apache/pig/PigConfiguration.java
    pig/branches/tez/src/org/apache/pig/PigConstants.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/BigDecimalWritable.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/BigIntegerWritable.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/HDataType.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/Launcher.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/JobControlCompiler.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
    pig/branches/tez/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java
    pig/branches/tez/src/org/apache/pig/builtin/BinStorage.java
    pig/branches/tez/src/org/apache/pig/builtin/MAX.java
    pig/branches/tez/src/org/apache/pig/builtin/MIN.java
    pig/branches/tez/src/org/apache/pig/builtin/TextLoader.java
    pig/branches/tez/src/org/apache/pig/builtin/Utf8StorageConverter.java
    pig/branches/tez/src/org/apache/pig/data/BinInterSedes.java
    pig/branches/tez/src/org/apache/pig/data/BinSedesTuple.java
    pig/branches/tez/src/org/apache/pig/data/DataReaderWriter.java
    pig/branches/tez/src/org/apache/pig/impl/io/NullablePartitionWritable.java
    pig/branches/tez/src/org/apache/pig/impl/io/NullableTuple.java
    pig/branches/tez/src/org/apache/pig/impl/io/PigNullableWritable.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/ExecutableManager.java
    pig/branches/tez/src/org/apache/pig/impl/streaming/OutputHandler.java
    pig/branches/tez/src/org/apache/pig/impl/util/CastUtils.java
    pig/branches/tez/src/org/apache/pig/impl/util/JarManager.java
    pig/branches/tez/src/org/apache/pig/impl/util/StorageUtil.java
    pig/branches/tez/src/org/apache/pig/newplan/PColFilterExtractor.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOCross.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOLoad.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOStream.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/rules/LoadTypeCastInserter.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/rules/PartitionFilterOptimizer.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/rules/StreamTypeCastInserter.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/rules/TypeCastInserter.java
    pig/branches/tez/src/org/apache/pig/newplan/logical/visitor/ScalarVisitor.java
    pig/branches/tez/src/org/apache/pig/parser/DryRunGruntParser.java
    pig/branches/tez/src/org/apache/pig/pen/util/DisplayExamples.java
    pig/branches/tez/src/org/apache/pig/scripting/ScriptEngine.java
    pig/branches/tez/src/org/apache/pig/tools/grunt/GruntParser.java
    pig/branches/tez/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
    pig/branches/tez/src/org/apache/pig/tools/pigstats/ScriptState.java
    pig/branches/tez/src/pig-default.properties   (props changed)
    pig/branches/tez/test/e2e/harness/test_harness.pl
    pig/branches/tez/test/e2e/pig/build.xml
    pig/branches/tez/test/e2e/pig/conf/default.conf
    pig/branches/tez/test/e2e/pig/drivers/TestDriverPig.pm
    pig/branches/tez/test/e2e/pig/drivers/TestDriverScript.pm
    pig/branches/tez/test/e2e/pig/tests/negative.conf
    pig/branches/tez/test/e2e/pig/tests/nightly.conf
    pig/branches/tez/test/e2e/pig/tests/turing_jython.conf
    pig/branches/tez/test/excluded-tests-23
    pig/branches/tez/test/org/apache/pig/pigunit/PigTest.java
    pig/branches/tez/test/org/apache/pig/test/PORead.java
    pig/branches/tez/test/org/apache/pig/test/TestBuiltin.java
    pig/branches/tez/test/org/apache/pig/test/TestConversions.java
    pig/branches/tez/test/org/apache/pig/test/TestEvalPipelineLocal.java
    pig/branches/tez/test/org/apache/pig/test/TestMultiQueryBasic.java
    pig/branches/tez/test/org/apache/pig/test/TestPOCast.java
    pig/branches/tez/test/org/apache/pig/test/TestPOUserFunc.java
    pig/branches/tez/test/org/apache/pig/test/TestPackage.java
    pig/branches/tez/test/org/apache/pig/test/TestPartitionFilterPushDown.java
    pig/branches/tez/test/org/apache/pig/test/TestPigServer.java
    pig/branches/tez/test/org/apache/pig/test/TestStore.java
    pig/branches/tez/test/org/apache/pig/test/TestTextDataParser.java
    pig/branches/tez/test/org/apache/pig/test/data/bzipdir1.bz2/bzipdir2.bz2/recordLossblockHeaderEndsAt136500.txt.bz2   (props changed)
    pig/branches/tez/test/org/apache/pig/test/pigunit/TestPigTest.java
    pig/branches/tez/test/org/apache/pig/test/utils/GenRandomData.java
    pig/branches/tez/test/unit-tests

Propchange: pig/branches/tez/
------------------------------------------------------------------------------
  Merged /pig/trunk:r1525170-1529032

Modified: pig/branches/tez/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/tez/CHANGES.txt?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/CHANGES.txt (original)
+++ pig/branches/tez/CHANGES.txt Thu Oct  3 23:24:40 2013
@@ -19,6 +19,22 @@
 Pig Change Log
 
 Trunk (unreleased changes)
+ 
+INCOMPATIBLE CHANGES
+
+PIG-3485: Remove CastUtils.bytesToMap(byte[] b) method from LoadCaster interface (cheolsoo)
+
+IMPROVEMENTS
+
+PIG-3484: Make the size of pig.script property configurable (cheolsoo)
+ 
+OPTIMIZATIONS
+ 
+BUG FIXES
+
+PIG-3469: Skewed join can cause unrecoverable NullPointerException when one of its inputs is missing (Jarek Jarcec Cecho  via xuefuz)
+
+Release 0.12.0 (unreleased changes)
 
 INCOMPATIBLE CHANGES
 
@@ -30,6 +46,17 @@ PIG-3174: Remove rpm and deb artifacts f
 
 IMPROVEMENTS
 
+PIG-3470: Print configuration variables in grunt (lbendig via daijy)
+
+PIG-3493: Add max/min for datetime (tyro89 via daijy)
+
+PIG-3479: Fix BigInt, BigDec, Date serialization. Improve perf of PigNullableWritable deserilization (dvryaboy)
+
+PIG-3461: Rewrite PartitionFilterOptimizer to make it work for all the cases (aniket486)
+
+PIG-2417: Streaming UDFs - allow users to easily write UDFs in scripting languages with no
+          JVM implementation. (jeremykarn via daijy)
+
 PIG-3199: Provide a method to retriever name of loader/storer in PigServer (prkommireddi via daijy)
 
 PIG-3367: Add assert keyword (operator) in pig (aniket486)
@@ -234,6 +261,26 @@ PIG-3013: BinInterSedes improve chararra
 
 BUG FIXES
 
+PIG-3495: Streaming udf e2e tests failures on Windows (daijy)
+
+PIG-3292: Logical plan invalid state: duplicate uid in schema during self-join to get cross product (cheolsoo via daijy)
+
+PIG-3491: Fix e2e failure Jython_Diagnostics_4 (daijy)
+
+PIG-3434: Null subexpression in bincond nullifies outer tuple (or bag) (mwagner via daijy)
+
+PIG-3114: Duplicated macro name error when using pigunit (daijy)
+
+PIG-3370: Add New Reserved Keywords To The Pig Docs (cheolsoo)
+
+PIG-3487: Fix syntax errors in nightly.conf (arpitgupta via daijy)
+
+PIG-3458: ScalarExpression lost with multiquery optimization (knoguchi)
+
+PIG-3360: Some intermittent negative e2e tests fail on hadoop 2 (daijy)
+
+PIG-3468: PIG-3123 breaks e2e test Jython_Diagnostics_2 (daijy)
+
 PIG-3471: Add a base abstract class for ExecutionEngine (cheolsoo)
 
 PIG-3457: Provide backward compatibility for PigStatsUtil and JobStats (daijy)

Modified: pig/branches/tez/build.xml
URL: http://svn.apache.org/viewvc/pig/branches/tez/build.xml?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/build.xml (original)
+++ pig/branches/tez/build.xml Thu Oct  3 23:24:40 2013
@@ -31,7 +31,7 @@
     <property name="pigsmoke.pom" value="${basedir}/ivy/pigsmoke.pom" />
     <property name="pigunit.pom" value="${basedir}/ivy/pigunit.pom" />
     <property name="piggybank.pom" value="${basedir}/ivy/piggybank.pom" />
-    <property name="pig.version" value="0.12.0" />
+    <property name="pig.version" value="0.13.0" />
     <property name="pig.version.suffix" value="-SNAPSHOT" />
     <property name="version" value="${pig.version}${pig.version.suffix}" />
     <property name="final.name" value="${name}-${version}" />
@@ -40,6 +40,7 @@
     <!-- source properties -->
     <property name="lib.dir" value="${basedir}/lib" />
     <property name="src.dir" value="${basedir}/src" />
+    <property name="python.src.dir" value="${src.dir}/python" />
     <property name="src.lib.dir" value="${basedir}/lib-src" />
     <property name="src.gen.dir" value="${basedir}/src-gen" />
     <property name="docs.dir" value="${basedir}/src/docs" />
@@ -587,6 +588,9 @@
             </javac>
             <copy file="${src.dir}/org/apache/pig/tools/grunt/autocomplete" todir="${build.classes}/org/apache/pig/tools/grunt"/>
             <copy file="${src.dir}/org/apache/pig/tools/grunt/autocomplete_aliases" todir="${build.classes}/org/apache/pig/tools/grunt"/>
+            <copy todir="${build.classes}/python">
+                <fileset dir="${python.src.dir}"/>
+            </copy>
         </sequential>
     </macrodef>
 
@@ -655,6 +659,7 @@
             </manifest>
             <fileset dir="${src.lib.dir}/shock"/>
             <fileset dir="${src.lib.dir}/bzip2"/>
+            <fileset dir="${python.src.dir}"/>
         </jar>
     </target>
     <target name="javadoc-jar" depends="cc-compile, javadoc">

Modified: pig/branches/tez/conf/pig.properties
URL: http://svn.apache.org/viewvc/pig/branches/tez/conf/pig.properties?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/conf/pig.properties (original)
+++ pig/branches/tez/conf/pig.properties Thu Oct  3 23:24:40 2013
@@ -216,3 +216,11 @@ pig.location.check.strict=false
 # This option is used to define whether to support recovery to handle the
 # application master getting restarted.
 # pig.output.committer.recovery.support=true
+
+# Set this option to true if you need to use the old partition filter optimizer. 
+# Note: Old filter optimizer PColFilterOptimizer will be deprecated in the future.
+# pig.exec.useOldPartitionFilterOptimize=true
+
+# By default, the size of pig script stored in job xml is limited to 10,240
+# characters. This property can be used to configure it.
+# pig.script.max.size=<somevalue>

Modified: pig/branches/tez/shims/src/hadoop20/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/shims/src/hadoop20/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/shims/src/hadoop20/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java (original)
+++ pig/branches/tez/shims/src/hadoop20/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java Thu Oct  3 23:24:40 2013
@@ -26,6 +26,7 @@ import org.apache.hadoop.mapred.Counters
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.jobcontrol.Job;
 import org.apache.hadoop.mapred.jobcontrol.JobControl;
+import org.apache.hadoop.mapred.TaskReport;
 import org.apache.hadoop.mapreduce.JobContext;
 import org.apache.hadoop.mapreduce.JobID;
 import org.apache.hadoop.mapreduce.OutputCommitter;
@@ -105,4 +106,13 @@ public class HadoopShims {
         JobClient jobClient = job.getJobClient();
         return jobClient.getJob(job.getAssignedJobID()).getCounters();
     }
+
+    public static boolean isJobFailed(TaskReport report) {
+        float successfulProgress = 1.0f;
+        // if the progress reported is not 1.0f then the map or reduce
+        // job failed
+        // this comparison is in place for the backward compatibility
+        // for Hadoop 0.20
+        return report.getProgress() != successfulProgress;
+    }
 }

Modified: pig/branches/tez/shims/src/hadoop23/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/shims/src/hadoop23/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/shims/src/hadoop23/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java (original)
+++ pig/branches/tez/shims/src/hadoop23/org/apache/pig/backend/hadoop/executionengine/shims/HadoopShims.java Thu Oct  3 23:24:40 2013
@@ -24,6 +24,8 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.mapred.Counters;
 import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.mapred.TIPStatus;
+import org.apache.hadoop.mapred.TaskReport;
 import org.apache.hadoop.mapred.jobcontrol.Job;
 import org.apache.hadoop.mapred.jobcontrol.JobControl;
 import org.apache.hadoop.mapreduce.ContextFactory;
@@ -109,4 +111,8 @@ public class HadoopShims {
     public static Counters getCounters(Job job) throws IOException, InterruptedException {
         return new Counters(job.getJob().getCounters());
     }
+    
+    public static boolean isJobFailed(TaskReport report) {
+        return report.getCurrentStatus()==TIPStatus.FAILED;
+    }
 }

Modified: pig/branches/tez/src/docs/src/documentation/content/xdocs/basic.xml
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/docs/src/documentation/content/xdocs/basic.xml?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/docs/src/documentation/content/xdocs/basic.xml (original)
+++ pig/branches/tez/src/docs/src/documentation/content/xdocs/basic.xml Thu Oct  3 23:24:40 2013
@@ -147,7 +147,7 @@
          
          <tr>
             <td> <p>-- D </p> </td>
-            <td> <p>datetime, %declare, %default, define, desc, describe, DIFF, distinct, double, du, dump</p> </td>
+            <td> <p>datetime, %declare, %default, define, dense, desc, describe, DIFF, distinct, double, du, dump</p> </td>
          </tr>  
          
          <tr>
@@ -217,7 +217,7 @@
          
          <tr>
             <td> <p>-- R </p> </td>
-            <td> <p>register, right, rm, rmf, run</p> </td>
+            <td> <p>register, returns, right, rm, rmf, rollup, run</p> </td>
          </tr>  
 
          <tr>
@@ -237,7 +237,7 @@
 
          <tr>
             <td> <p>-- V, W, X, Y, Z </p> </td>
-            <td> <p> </p> </td>
+            <td> <p>void</p> </td>
          </tr>  
             
    </table>

Modified: pig/branches/tez/src/docs/src/documentation/content/xdocs/tabs.xml
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/docs/src/documentation/content/xdocs/tabs.xml?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/docs/src/documentation/content/xdocs/tabs.xml (original)
+++ pig/branches/tez/src/docs/src/documentation/content/xdocs/tabs.xml Thu Oct  3 23:24:40 2013
@@ -32,6 +32,6 @@
   -->
   <tab label="Project" href="http://hadoop.apache.org/pig/" type="visible" /> 
   <tab label="Wiki" href="http://wiki.apache.org/pig/" type="visible" /> 
-  <tab label="Pig 0.11.0 Documentation" dir="" type="visible" /> 
+  <tab label="Pig 0.12.0 Documentation" dir="" type="visible" /> 
 
 </tabs>

Modified: pig/branches/tez/src/org/apache/pig/LoadCaster.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/LoadCaster.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/LoadCaster.java (original)
+++ pig/branches/tez/src/org/apache/pig/LoadCaster.java Thu Oct  3 23:24:40 2013
@@ -100,15 +100,6 @@ public interface LoadCaster {
     /**
      * Cast data from bytearray to map value.
      * @param b bytearray to be cast.
-     * @return Map value.
-     * @throws IOException if the value cannot be cast.
-     */
-    @Deprecated
-    public Map<String, Object> bytesToMap(byte[] b) throws IOException;
-
-    /**
-     * Cast data from bytearray to map value.
-     * @param b bytearray to be cast.
      * @param fieldSchema field schema for the output map
      * @return Map value.
      * @throws IOException if the value cannot be cast.

Modified: pig/branches/tez/src/org/apache/pig/PigConfiguration.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/PigConfiguration.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/PigConfiguration.java (original)
+++ pig/branches/tez/src/org/apache/pig/PigConfiguration.java Thu Oct  3 23:24:40 2013
@@ -99,4 +99,14 @@ public class PigConfiguration {
      * application master getting restarted.
      */
     public static final String PIG_OUTPUT_COMMITTER_RECOVERY = "pig.output.committer.recovery.support";
+
+    /**
+     * This key is used to turn off the inclusion of settings in the jobs.
+     */
+    public static final String INSERT_ENABLED = "pig.script.info.enabled";
+
+    /**
+     * Controls the size of Pig script stored in job xml.
+     */
+    public static final String MAX_SCRIPT_SIZE = "pig.script.max.size";
 }

Modified: pig/branches/tez/src/org/apache/pig/PigConstants.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/PigConstants.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/PigConstants.java (original)
+++ pig/branches/tez/src/org/apache/pig/PigConstants.java Thu Oct  3 23:24:40 2013
@@ -46,4 +46,11 @@ public class PigConstants {
      * by default, all rules are enabled.
      */
     public static final String PIG_OPTIMIZER_RULES_DISABLED_KEY = "pig.optimizer.rules.disabled";
+
+    /**
+     * flag to use old PartitionFilterOptimizer in case NewPartitionFilterOptimizer is not backwards compatible
+     * (A known case is "filter a by 1 == 0").
+     */
+    public static final String PIG_EXEC_OLD_PART_FILTER_OPTIMIZER = "pig.exec.useOldPartitionFilterOptimizer";
+
 }
\ No newline at end of file

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/BigDecimalWritable.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/BigDecimalWritable.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/BigDecimalWritable.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/BigDecimalWritable.java Thu Oct  3 23:24:40 2013
@@ -58,7 +58,7 @@ public class BigDecimalWritable implemen
 
     @Override
     public void readFields(DataInput in) throws IOException {
-        value = (BigDecimal)bis.readDatum(in, DataType.BIGDECIMAL);
+        value = (BigDecimal)bis.readDatum(in);
     }
 
     @Override
@@ -76,6 +76,7 @@ public class BigDecimalWritable implemen
             super(BigDecimalWritable.class);
         }
 
+        @Override
         public int compare(byte[] b1, int s1, int l1,
                            byte[] b2, int s2, int l2) {
             try {

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/BigIntegerWritable.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/BigIntegerWritable.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/BigIntegerWritable.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/BigIntegerWritable.java Thu Oct  3 23:24:40 2013
@@ -58,7 +58,7 @@ public class BigIntegerWritable implemen
 
     @Override
     public void readFields(DataInput in) throws IOException {
-        value = (BigInteger)bis.readDatum(in, DataType.BIGINTEGER);
+        value = (BigInteger)bis.readDatum(in);
     }
 
     @Override
@@ -76,6 +76,7 @@ public class BigIntegerWritable implemen
             super(BigIntegerWritable.class);
         }
 
+        @Override
         public int compare(byte[] b1, int s1, int l1,
                            byte[] b2, int s2, int l2) {
             try {

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/HDataType.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/HDataType.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/HDataType.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/HDataType.java Thu Oct  3 23:24:40 2013
@@ -19,6 +19,8 @@ package org.apache.pig.backend.hadoop;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.pig.PigException;
@@ -60,6 +62,30 @@ public class HDataType {
     static NullableTuple defTup = new NullableTuple();
     static Map<Byte, String> typeToName = null;
 
+    private static final HashMap<String, Byte> classToTypeMap = new HashMap<String, Byte>();
+    static {
+        classToTypeMap.put("org.apache.pig.impl.io.NullableBag", DataType.BAG);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableBigDecimalWritable", DataType.BIGDECIMAL);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableBigIntegerWritable", DataType.BIGINTEGER);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableBooleanWritable", DataType.BOOLEAN);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableBytesWritable", DataType.BYTEARRAY);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableDateTimeWritable", DataType.DATETIME);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableDoubleWritable", DataType.DOUBLE);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableFloatWritable", DataType.FLOAT);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableIntWritable", DataType.INTEGER);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableLongWritable", DataType.LONG);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableText", DataType.CHARARRAY);
+        classToTypeMap.put("org.apache.pig.impl.io.NullableTuple", DataType.TUPLE);
+    }
+
+    public static PigNullableWritable getWritableComparable(String className) throws ExecException {
+        if (classToTypeMap.containsKey(className)) {
+            return getWritableComparableTypes(null, classToTypeMap.get(className));
+        } else {
+            throw new ExecException("Unable to map " + className + " to known types." + Arrays.toString(classToTypeMap.keySet().toArray()));
+        }
+    }
+
     public static PigNullableWritable getWritableComparableTypes(Object o, byte keyType) throws ExecException{
 
         byte newKeyType = keyType;

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/HExecutionEngine.java Thu Oct  3 23:24:40 2013
@@ -260,6 +260,14 @@ public abstract class HExecutionEngine i
             disabledOptimizerRules = new HashSet<String>();
         }
 
+        if( ! Boolean.valueOf(this.pigContext.getProperties().getProperty(
+                PigConstants.PIG_EXEC_OLD_PART_FILTER_OPTIMIZER, "false"))){
+            // Turn off the old partition filter optimizer
+            disabledOptimizerRules.add("PartitionFilterOptimizer");
+        } else {
+            disabledOptimizerRules.add("NewPartitionFilterOptimizer");
+        }
+
         String pigOptimizerRulesDisabled = this.pigContext.getProperties()
                 .getProperty(PigConstants.PIG_OPTIMIZER_RULES_DISABLED_KEY);
         if (pigOptimizerRulesDisabled != null) {
@@ -270,6 +278,7 @@ public abstract class HExecutionEngine i
         if (pigContext.inIllustrator) {
             disabledOptimizerRules.add("MergeForEach");
             disabledOptimizerRules.add("PartitionFilterOptimizer");
+            disabledOptimizerRules.add("NewPartitionFilterOptimizer");
             disabledOptimizerRules.add("LimitOptimizer");
             disabledOptimizerRules.add("SplitFilter");
             disabledOptimizerRules.add("PushUpFilter");

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/Launcher.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/Launcher.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/Launcher.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/Launcher.java Thu Oct  3 23:24:40 2013
@@ -33,6 +33,7 @@ import org.apache.hadoop.mapred.JobClien
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.JobID;
 import org.apache.hadoop.mapred.RunningJob;
+import org.apache.hadoop.mapred.TIPStatus;
 import org.apache.hadoop.mapred.TaskReport;
 import org.apache.hadoop.mapred.jobcontrol.Job;
 import org.apache.hadoop.mapred.jobcontrol.JobControl;
@@ -42,6 +43,7 @@ import org.apache.pig.backend.BackendExc
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.JobCreationException;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.plans.PhysicalPlan;
+import org.apache.pig.backend.hadoop.executionengine.shims.HadoopShims;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.plan.PlanException;
 import org.apache.pig.impl.plan.VisitorException;
@@ -198,14 +200,8 @@ public abstract class Launcher {
             ArrayList<Exception> exceptions = new ArrayList<Exception>();
             String exceptionCreateFailMsg = null;
             boolean jobFailed = false;
-            float successfulProgress = 1.0f;
             if (msgs.length > 0) {
-                // if the progress reported is not 1.0f then the map or reduce
-                // job failed
-                // this comparison is in place till Hadoop 0.20 provides methods
-                // to query
-                // job status
-                if (reports[i].getProgress() != successfulProgress) {
+                if (HadoopShims.isJobFailed(reports[i])) {
                     jobFailed = true;
                 }
                 Set<String> errorMessageSet = new HashSet<String>();
@@ -234,7 +230,7 @@ public abstract class Launcher {
                 }
             }
             // if there are no valid exception that could be created, report
-            if ((exceptions.size() == 0) && (exceptionCreateFailMsg != null)) {
+            if (jobFailed && (exceptions.size() == 0) && (exceptionCreateFailMsg != null)) {
                 int errCode = 2997;
                 String msg = "Unable to recreate exception from backed error: "
                         + exceptionCreateFailMsg;

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/JobControlCompiler.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/JobControlCompiler.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/JobControlCompiler.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/JobControlCompiler.java Thu Oct  3 23:24:40 2013
@@ -54,6 +54,7 @@ import org.apache.hadoop.mapred.jobcontr
 import org.apache.pig.ComparisonFunc;
 import org.apache.pig.ExecType;
 import org.apache.pig.LoadFunc;
+import org.apache.pig.PigConfiguration;
 import org.apache.pig.PigException;
 import org.apache.pig.StoreFuncInterface;
 import org.apache.pig.backend.executionengine.ExecException;
@@ -104,7 +105,6 @@ import org.apache.pig.impl.util.ObjectSe
 import org.apache.pig.impl.util.Pair;
 import org.apache.pig.impl.util.UDFContext;
 import org.apache.pig.impl.util.Utils;
-import org.apache.pig.tools.pigstats.ScriptState;
 import org.apache.pig.tools.pigstats.mapreduce.MRScriptState;
 
 /**
@@ -436,7 +436,7 @@ public class JobControlCompiler{
         Path tmpLocation = null;
 
         // add settings for pig statistics
-        String setScriptProp = conf.get(ScriptState.INSERT_ENABLED, "true");
+        String setScriptProp = conf.get(PigConfiguration.INSERT_ENABLED, "true");
         if (setScriptProp.equalsIgnoreCase("true")) {
             MRScriptState ss = MRScriptState.get();
             ss.addSettingsToConf(mro, conf);
@@ -864,7 +864,7 @@ public class JobControlCompiler{
             org.apache.hadoop.mapreduce.Job nwJob) throws IOException {
         int jobParallelism = calculateRuntimeReducers(mro, nwJob);
 
-        if (mro.isSampler()) {
+        if (mro.isSampler() && plan.getSuccessors(mro) != null) {
             // We need to calculate the final number of reducers of the next job (order-by or skew-join)
             // to generate the quantfile.
             MapReduceOper nextMro = plan.getSuccessors(mro).get(0);

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POCast.java Thu Oct  3 23:24:40 2013
@@ -1384,14 +1384,7 @@ public class POCast extends ExpressionOp
                     result = obj;
             } else if (obj instanceof DataByteArray) {
                 if (null != caster) {
-                    try {
-                        result = caster.bytesToMap(((DataByteArray)obj).get(), fs);
-                    }  catch(AbstractMethodError e) {
-                        // this is for backward compatibility wherein some old LoadCaster
-                        // which does not implement bytesToMap(byte[] b, ResourceFieldSchema fieldSchema)
-                        // In this case, we only cast bytes to map, but leave the value as bytearray
-                        result = caster.bytesToMap(((DataByteArray)obj).get());
-                    }
+                    result = caster.bytesToMap(((DataByteArray)obj).get(), fs);
                 } else {
                     int errCode = 1075;
                     String msg = "Received a bytearray from the UDF. Cannot determine how to convert the bytearray to tuple.";
@@ -1955,14 +1948,7 @@ public class POCast extends ExpressionOp
                 }
                 try {
                     if (null != caster) {
-                        try {
-                            res.result = caster.bytesToMap(dba.get(), fieldSchema);
-                        } catch(AbstractMethodError e) {
-                            // this is for backward compatibility wherein some old LoadCaster
-                            // which does not implement bytesToMap(byte[] b, ResourceFieldSchema fieldSchema)
-                            // In this case, we only cast bytes to map, but leave the value as bytearray
-                            res.result = caster.bytesToMap(dba.get());
-                        }
+                        res.result = caster.bytesToMap(dba.get(), fieldSchema);
                     } else {
                         int errCode = 1075;
                         String msg = "Received a bytearray from the UDF. Cannot determine how to convert the bytearray to map.";

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java Thu Oct  3 23:24:40 2013
@@ -219,7 +219,7 @@ public class POUserFunc extends Expressi
 
             for(PhysicalOperator op : inputs) {
                 temp = op.getNext(op.getResultType());
-                if(temp.returnStatus!=POStatus.STATUS_OK) {
+                if(temp.returnStatus!=POStatus.STATUS_OK && temp.returnStatus!=POStatus.STATUS_NULL) {
                     return temp;
                 }
 

Modified: pig/branches/tez/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java (original)
+++ pig/branches/tez/src/org/apache/pig/backend/hadoop/hbase/HBaseBinaryConverter.java Thu Oct  3 23:24:40 2013
@@ -92,15 +92,8 @@ public class HBaseBinaryConverter implem
     }
 
     @Override
-    public Map<String, Object> bytesToMap(byte[] b) throws IOException {
-        return bytesToMap(b, null);
-    }
-    /**
-     * NOT IMPLEMENTED
-     */
-    @Override
     public Map<String, Object> bytesToMap(byte[] b, ResourceFieldSchema fieldSchema) throws IOException {
-        throw new ExecException("Can't generate a Map from byte[]");
+        return bytesToMap(b, fieldSchema);
     }
 
     /**

Modified: pig/branches/tez/src/org/apache/pig/builtin/BinStorage.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/builtin/BinStorage.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/builtin/BinStorage.java (original)
+++ pig/branches/tez/src/org/apache/pig/builtin/BinStorage.java Thu Oct  3 23:24:40 2013
@@ -118,11 +118,6 @@ implements StoreFuncInterface, LoadMetad
         }
 
         @Override
-        public Map<String, Object> bytesToMap(byte[] b) throws IOException {
-            return bytesToMap(b, null);
-        }
-
-        @Override
         public Map<String, Object> bytesToMap(byte[] b, ResourceFieldSchema fieldSchema) throws IOException {
             throw new ExecException(unImplementedErrorMessage, 1118);
         }

Modified: pig/branches/tez/src/org/apache/pig/builtin/MAX.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/builtin/MAX.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/builtin/MAX.java (original)
+++ pig/branches/tez/src/org/apache/pig/builtin/MAX.java Thu Oct  3 23:24:40 2013
@@ -75,6 +75,7 @@ public class MAX extends AlgebraicByteAr
         funcList.add(new FuncSpec(IntMax.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER)));
         funcList.add(new FuncSpec(LongMax.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.LONG)));
         funcList.add(new FuncSpec(StringMax.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.CHARARRAY)));
+        funcList.add(new FuncSpec(DateTimeMax.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.DATETIME)));
         return funcList;
     }
 }

Modified: pig/branches/tez/src/org/apache/pig/builtin/MIN.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/builtin/MIN.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/builtin/MIN.java (original)
+++ pig/branches/tez/src/org/apache/pig/builtin/MIN.java Thu Oct  3 23:24:40 2013
@@ -75,6 +75,7 @@ public class MIN extends  AlgebraicByteA
         funcList.add(new FuncSpec(IntMin.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.INTEGER)));
         funcList.add(new FuncSpec(LongMin.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.LONG)));
         funcList.add(new FuncSpec(StringMin.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.CHARARRAY)));
+        funcList.add(new FuncSpec(DateTimeMin.class.getName(), Schema.generateNestedSchema(DataType.BAG, DataType.DATETIME)));
         return funcList;
     }
 }

Modified: pig/branches/tez/src/org/apache/pig/builtin/TextLoader.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/builtin/TextLoader.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/builtin/TextLoader.java (original)
+++ pig/branches/tez/src/org/apache/pig/builtin/TextLoader.java Thu Oct  3 23:24:40 2013
@@ -147,19 +147,8 @@ public class TextLoader extends LoadFunc
     }
 
     @Override
-    public Map<String, Object> bytesToMap(byte[] b) throws IOException {
-        return bytesToMap(b, null);
-    }
-
-    /**
-     * TextLoader does not support conversion to Map
-     * @throws IOException if the value cannot be cast.
-     */
-    @Override
     public Map<String, Object> bytesToMap(byte[] b, ResourceFieldSchema schema) throws IOException {
-        int errCode = 2109;
-        String msg = "TextLoader does not support conversion to Map.";
-        throw new ExecException(msg, errCode, PigException.BUG);
+        return bytesToMap(b, schema);
     }
 
     /**

Modified: pig/branches/tez/src/org/apache/pig/builtin/Utf8StorageConverter.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/builtin/Utf8StorageConverter.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/builtin/Utf8StorageConverter.java (original)
+++ pig/branches/tez/src/org/apache/pig/builtin/Utf8StorageConverter.java Thu Oct  3 23:24:40 2013
@@ -553,11 +553,6 @@ public class Utf8StorageConverter implem
     }
 
     @Override
-    public Map<String, Object> bytesToMap(byte[] b) throws IOException {
-        return bytesToMap(b, null);
-    }
-
-    @Override
     public Tuple bytesToTuple(byte[] b, ResourceFieldSchema fieldSchema) throws IOException {
         if(b == null)
             return null;

Modified: pig/branches/tez/src/org/apache/pig/data/BinInterSedes.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/data/BinInterSedes.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/data/BinInterSedes.java (original)
+++ pig/branches/tez/src/org/apache/pig/data/BinInterSedes.java Thu Oct  3 23:24:40 2013
@@ -435,7 +435,7 @@ public class BinInterSedes implements In
     }
 
     private Object readBigDecimal(DataInput in) throws IOException {
-        return new BigDecimal((String)readDatum(in));
+        return  new BigDecimal((String)readDatum(in));
     }
 
     private Object readBigInteger(DataInput in) throws IOException {

Modified: pig/branches/tez/src/org/apache/pig/data/BinSedesTuple.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/data/BinSedesTuple.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/data/BinSedesTuple.java (original)
+++ pig/branches/tez/src/org/apache/pig/data/BinSedesTuple.java Thu Oct  3 23:24:40 2013
@@ -34,7 +34,6 @@ public class BinSedesTuple extends Defau
 
     private static final long serialVersionUID = 1L;
     private static final InterSedes sedes = InterSedesFactory.getInterSedesInstance();
-    
 
     @Override
     public void write(DataOutput out) throws IOException {
@@ -47,8 +46,8 @@ public class BinSedesTuple extends Defau
         // Clear our fields, in case we're being reused.
         mFields.clear();
         sedes.addColsToTuple(in, this);
-    } 
-    
+    }
+
 
 
     /**
@@ -87,7 +86,7 @@ public class BinSedesTuple extends Defau
     BinSedesTuple(List<Object> c, int junk) {
         super(c, junk);
     }
-    
+
     public static Class<? extends TupleRawComparator> getComparatorClass() {
         return InterSedesFactory.getInterSedesInstance().getTupleRawComparatorClass();
     }

Modified: pig/branches/tez/src/org/apache/pig/data/DataReaderWriter.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/data/DataReaderWriter.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/data/DataReaderWriter.java (original)
+++ pig/branches/tez/src/org/apache/pig/data/DataReaderWriter.java Thu Oct  3 23:24:40 2013
@@ -303,6 +303,7 @@ public class DataReaderWriter {
                 out.writeByte(DataType.DATETIME);
                 out.writeLong(((DateTime)val).getMillis());
                 out.writeShort(((DateTime)val).getZone().getOffset((DateTime)val) / 60000);
+                break;
 
             case DataType.BYTEARRAY: {
                 out.writeByte(DataType.BYTEARRAY);

Modified: pig/branches/tez/src/org/apache/pig/impl/io/NullablePartitionWritable.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/io/NullablePartitionWritable.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/io/NullablePartitionWritable.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/io/NullablePartitionWritable.java Thu Oct  3 23:24:40 2013
@@ -21,6 +21,8 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.pig.backend.hadoop.HDataType;
+
 /**
  * NullablePartitionWritable is an adaptor class around PigNullableWritable that adds a partition
  * index to the class.
@@ -30,9 +32,9 @@ public class NullablePartitionWritable e
 	private PigNullableWritable key;
 
 	public NullablePartitionWritable() {
-		
+
 	}
-	
+
 	public NullablePartitionWritable(PigNullableWritable k) {
 		setKey(k);
 	}
@@ -53,50 +55,60 @@ public class NullablePartitionWritable e
 		return partitionIndex;
 	}
 
-  	public int compareTo(Object o) {  		
+  	@Override
+    public int compareTo(Object o) {
 		return key.compareTo(((NullablePartitionWritable)o).getKey());
 	}
-	
-	public void readFields(DataInput in) throws IOException {
+
+	@Override
+    public void readFields(DataInput in) throws IOException {
 		String c = in.readUTF();
-		try{
-			key = (PigNullableWritable)Class.forName(c).newInstance();
-		}catch(Exception e) {
+		try {
+			key = HDataType.getWritableComparable(c);
+		} catch(Exception e) {
 			throw new IOException(e);
 		}
 		key.readFields(in);
 	}
 
-	public void write(DataOutput out) throws IOException {
+	@Override
+    public void write(DataOutput out) throws IOException {
 		out.writeUTF(key.getClass().getName());
 		key.write(out);
 	}
 
-	public boolean isNull() {
+	@Override
+    public boolean isNull() {
 		return key.isNull();
 	}
 
-	public void setNull(boolean isNull) {
+	@Override
+    public void setNull(boolean isNull) {
 		key.setNull(isNull);
 	}
 
-	public byte getIndex() {
+	@Override
+    public byte getIndex() {
 		return key.getIndex();
 	}
 
-	public void setIndex(byte index) {
+	@Override
+    public void setIndex(byte index) {
 		key.setIndex(index);
 	}
 
-	public Object getValueAsPigType() {
+	@Override
+    public Object getValueAsPigType() {
 		return key.getValueAsPigType();
 	}
 
-	public int hashCode() {
+	@Override
+    public int hashCode() {
 		return key.hashCode();
 	}
-	
-	public String toString() {
+
+	@Override
+    public String toString() {
 		return "Partition: " + partitionIndex + " " + key.toString();
 	}
 }

Modified: pig/branches/tez/src/org/apache/pig/impl/io/NullableTuple.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/io/NullableTuple.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/io/NullableTuple.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/io/NullableTuple.java Thu Oct  3 23:24:40 2013
@@ -42,6 +42,7 @@ public class NullableTuple extends PigNu
         mValue = t;
     }
 
+    @Override
     public Object getValueAsPigType() {
         return isNull() ? null : (Tuple)mValue;
     }

Modified: pig/branches/tez/src/org/apache/pig/impl/io/PigNullableWritable.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/io/PigNullableWritable.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/io/PigNullableWritable.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/io/PigNullableWritable.java Thu Oct  3 23:24:40 2013
@@ -33,7 +33,7 @@ import org.apache.pig.data.Tuple;
  * It also provides a getIndex() and setIndex() calls that are used to get
  * and set the index.  These can be used by LocalRearrange, the partitioner,
  * and Package to determine the index.
- * 
+ *
  * Index and the null indicator are packed into one byte to save space.
  */
 
@@ -48,19 +48,19 @@ public abstract class PigNullableWritabl
      * This is a bitmask used in those cases.
      */
     public static final byte mqFlag = (byte)0x80;
-    
+
     /**
      *  regular indices used in group and cogroup
      *  can only go from 0x00 to 0x7F
      */
     public static final byte idxSpace = (byte)0x7F;
-    
+
     private boolean mNull;
 
     protected WritableComparable mValue;
 
     private byte mIndex;
-       
+
     /**
      * Compare two nullable objects.  Step one is to check if either or both
      * are null.  If one is null and the other is not, then the one that is
@@ -71,18 +71,19 @@ public abstract class PigNullableWritabl
      * These comparators are used by hadoop as part of the post-map sort, when
      * the data is still in object format.
      */
+    @Override
     public int compareTo(Object o) {
         PigNullableWritable w = (PigNullableWritable)o;
 
         if ((mIndex & mqFlag) != 0) { // this is a multi-query index
-            
+
             if ((mIndex & idxSpace) < (w.mIndex & idxSpace)) return -1;
             else if ((mIndex & idxSpace) > (w.mIndex & idxSpace)) return 1;
         }
-        
+
         if (!mNull && !w.mNull) {
             int result = mValue.compareTo(w.mValue);
-            
+
             // If any of the field inside tuple is null, then we do not merge keys
             // See PIG-927
             if (result == 0 && mValue instanceof Tuple && w.mValue instanceof Tuple)
@@ -102,13 +103,14 @@ public abstract class PigNullableWritabl
             else if ((mIndex & idxSpace) > (w.mIndex & idxSpace)) return 1;
             else return 0;
         }
-        else if (mNull) return -1; 
+        else if (mNull) return -1;
         else return 1;
     }
 
     /* (non-Javadoc)
      * @see org.apache.hadoop.io.IntWritable#readFields(java.io.DataInput)
      */
+    @Override
     public void readFields(DataInput in) throws IOException {
         mNull = in.readBoolean();
         if (!mNull) mValue.readFields(in);
@@ -118,6 +120,7 @@ public abstract class PigNullableWritabl
     /* (non-Javadoc)
      * @see org.apache.hadoop.io.IntWritable#write(java.io.DataOutput)
      */
+    @Override
     public void write(DataOutput out) throws IOException {
         out.writeBoolean(mNull);
         if (!mNull) mValue.write(out);
@@ -137,7 +140,7 @@ public abstract class PigNullableWritabl
     public void setNull(boolean isNull) {
         mNull = isNull;
     }
-    
+
     /**
      * @return the index for this value
      */
@@ -169,8 +172,8 @@ public abstract class PigNullableWritabl
         else return mValue.hashCode();
     }
 
-    
-    
+
+
     @Override
     public boolean equals(Object arg0) {
         return compareTo(arg0)==0;

Modified: pig/branches/tez/src/org/apache/pig/impl/streaming/ExecutableManager.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/streaming/ExecutableManager.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/streaming/ExecutableManager.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/streaming/ExecutableManager.java Thu Oct  3 23:24:40 2013
@@ -17,32 +17,24 @@
  */
 package org.apache.pig.impl.streaming;
 
-import static org.apache.pig.PigConfiguration.PIG_STREAMING_ENVIRONMENT;
-
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
 import java.util.concurrent.BlockingQueue;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.conf.Configuration;
 import org.apache.pig.backend.executionengine.ExecException;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.POStatus;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.Result;
 import org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POStream;
 import org.apache.pig.data.Tuple;
 import org.apache.pig.impl.io.BufferedPositionedInputStream;
-import org.apache.pig.impl.io.FileLocalizer;
 import org.apache.pig.impl.streaming.InputHandler.InputType;
 import org.apache.pig.impl.streaming.OutputHandler.OutputType;
 import org.apache.pig.impl.util.UDFContext;
@@ -60,12 +52,9 @@ import org.apache.pig.impl.util.UDFConte
 public class ExecutableManager {
     private static final Log LOG = LogFactory.getLog(ExecutableManager.class);
     private static final int SUCCESS = 0;
-    private static final String PATH = "PATH";
-    private static final String BASH = "bash";
     private static final Result EOS_RESULT = new Result(POStatus.STATUS_EOS, null);
 
     protected StreamingCommand command; // Streaming command to be run
-    String argvAsString; // Parsed commands
 
     Process process; // Handle to the process
     protected int exitCode = -127; // Exit code of the process
@@ -109,12 +98,6 @@ public class ExecutableManager {
     public void configure(POStream stream) throws IOException, ExecException {
         this.poStream = stream;
         this.command = stream.getCommand();
-        String[] argv = this.command.getCommandArgs();
-        argvAsString = "";
-        for (String arg : argv) {
-            argvAsString += arg;
-            argvAsString += " ";
-        }
 
         // Create the input/output handlers
         this.inputHandler = HandlerFactory.createInputHandler(command);
@@ -204,57 +187,6 @@ public class ExecutableManager {
     }
 
     /**
-     * Set up the run-time environment of the managed process.
-     *
-     * @param pb
-     *            {@link ProcessBuilder} used to exec the process
-     */
-    protected void setupEnvironment(ProcessBuilder pb) {
-        String separator = ":";
-        Configuration conf = UDFContext.getUDFContext().getJobConf();
-        Map<String, String> env = pb.environment();
-        addJobConfToEnvironment(conf, env);
-
-        // Add the current-working-directory to the $PATH
-        File dir = pb.directory();
-        String cwd = (dir != null) ? dir.getAbsolutePath() : System
-                .getProperty("user.dir");
-
-        String envPath = env.get(PATH);
-        if (envPath == null) {
-            envPath = cwd;
-        } else {
-            envPath = envPath + separator + cwd;
-        }
-        env.put(PATH, envPath);
-    }
-
-    void addJobConfToEnvironment(Configuration conf, Map<String, String> env) {
-        String propsToSend = conf.get(PIG_STREAMING_ENVIRONMENT);
-        LOG.debug("Properties to ship to streaming environment set in "+PIG_STREAMING_ENVIRONMENT+": " + propsToSend);
-        if (propsToSend == null) {
-            return;
-        }
-
-        for (String prop : propsToSend.split(",")) {
-            String value = conf.get(prop);
-            if (value == null) {
-                LOG.warn("Property set in "+PIG_STREAMING_ENVIRONMENT+" not found in Configuration: " + prop);
-                continue;
-            }
-            LOG.debug("Setting property in streaming environment: " + prop);
-            envPut(env, prop, value);
-        }
-    }
-
-    void envPut(Map<String, String> env, String name, String value) {
-        if (LOG.isDebugEnabled()) {
-          LOG.debug("Add  env entry:" + name + "=" + value);
-        }
-        env.put(name, value);
-    }
-
-    /**
      * Start execution of the external process.
      *
      * This takes care of setting up the environment of the process and also
@@ -264,26 +196,7 @@ public class ExecutableManager {
      * @throws IOException
      */
     protected void exec() throws IOException {
-        // Set the actual command to run with 'bash -c exec ...'
-        List<String> cmdArgs = new ArrayList<String>();
-
-        if (System.getProperty("os.name").toUpperCase().startsWith("WINDOWS")) {
-          cmdArgs.add("cmd");
-          cmdArgs.add("/c");
-          cmdArgs.add(argvAsString);
-        } else {
-          cmdArgs.add(BASH);
-          cmdArgs.add("-c");
-          StringBuffer sb = new StringBuffer();
-          sb.append("exec ");
-          sb.append(argvAsString);
-          cmdArgs.add(sb.toString());
-        }
-
-        // Start the external process
-        ProcessBuilder processBuilder = new ProcessBuilder(cmdArgs
-                .toArray(new String[cmdArgs.size()]));
-        setupEnvironment(processBuilder);
+        ProcessBuilder processBuilder = StreamingUtil.createProcess(this.command);
         process = processBuilder.start();
         LOG.debug("Started the process for command: " + command);
 
@@ -514,7 +427,7 @@ public class ExecutableManager {
                 try {
                     Result res = new Result();
                     res.result = "Error reading output from Streaming binary:" +
-                            "'" + argvAsString + "':" + t.getMessage();
+                            "'" + command.toString() + "':" + t.getMessage();
                     res.returnStatus = POStatus.STATUS_ERR;
                     sendOutput(binaryOutputQueue, res);
                     killProcess(process);
@@ -547,7 +460,7 @@ public class ExecutableManager {
 
                     }
                     // signal error
-                    String errMsg = "Failure while waiting for process (" + argvAsString + ")" +
+                    String errMsg = "Failure while waiting for process (" + command.toString() + ")" +
                             ie.getMessage();
                     LOG.error(errMsg, ie);
                     res.result = errMsg;
@@ -561,7 +474,7 @@ public class ExecutableManager {
                 } else {
                     // signal Error
 
-                    String errMsg = "'" + argvAsString + "'" + " failed with exit status: "
+                    String errMsg = "'" + command.toString() + "'" + " failed with exit status: "
                             + exitCode;
                     LOG.error(errMsg);
                     res.result = errMsg;

Modified: pig/branches/tez/src/org/apache/pig/impl/streaming/OutputHandler.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/streaming/OutputHandler.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/streaming/OutputHandler.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/streaming/OutputHandler.java Thu Oct  3 23:24:40 2013
@@ -26,6 +26,8 @@ import org.apache.pig.StreamToPig;
 import org.apache.pig.data.Tuple;
 import org.apache.pig.impl.io.BufferedPositionedInputStream;
 
+import com.google.common.base.Charsets;
+
 /**
  * {@link OutputHandler} is responsible for handling the output of the
  * Pig-Streaming external command.
@@ -36,6 +38,9 @@ import org.apache.pig.impl.io.BufferedPo
  * process wrote its output.
  */
 public abstract class OutputHandler {
+    public static final Object END_OF_OUTPUT = new Object();
+    private static final byte[] DEFAULT_RECORD_DELIM = new byte[] {'\n'};
+
     public enum OutputType {SYNCHRONOUS, ASYNCHRONOUS}
 
     /*
@@ -53,6 +58,11 @@ public abstract class OutputHandler {
     private Text currValue = new Text();
 
     private BufferedPositionedInputStream istream;
+    
+    //Both of these ignore the trailing \n.  So if the
+    //default delimiter is "\n" recordDelimStr is "".
+    private String recordDelimStr = null;
+    private int recordDelimLength = 0;
 
     /**
      * Get the handled <code>OutputType</code>.
@@ -92,8 +102,7 @@ public abstract class OutputHandler {
         }
 
         currValue.clear();
-        int num = in.readLine(currValue);
-        if (num <= 0) {
+        if (!readValue()) {
             return null;
         }
 
@@ -106,6 +115,54 @@ public abstract class OutputHandler {
         }
     }
 
+    private boolean readValue() throws IOException {
+        int num = in.readLine(currValue);
+        if (num <= 0) {
+            return false;
+        }
+
+        while(!isEndOfRow()) {
+            //Need to add back the newline character we ate.
+            currValue.append(new byte[] {'\n'}, 0, 1);
+
+            byte[] lineBytes = readNextLine();
+            if (lineBytes == null) {
+                //We have no more input, so just break;
+                break;
+            }
+            currValue.append(lineBytes, 0, lineBytes.length);
+        }
+        
+        return true;
+    }
+    
+    private byte[] readNextLine() throws IOException {
+        Text line = new Text();
+        int num = in.readLine(line);
+        byte[] lineBytes = line.getBytes();
+        if (num <= 0) {
+            return null;
+        }
+        
+        return lineBytes;
+    }
+
+    private boolean isEndOfRow() {
+        if (recordDelimStr == null) {
+            byte[] recordDelimBa = getRecordDelimiter();
+            recordDelimLength = recordDelimBa.length - 1; //Ignore trailing \n
+            recordDelimStr = new String(recordDelimBa, 0, recordDelimLength,  Charsets.UTF_8);
+        }
+        if (recordDelimLength == 0 || currValue.getLength() < recordDelimLength) {
+            return true;
+        }
+        return currValue.find(recordDelimStr, currValue.getLength() - recordDelimLength) >= 0;
+    }
+    
+    protected byte[] getRecordDelimiter() {
+        return DEFAULT_RECORD_DELIM;
+    }
+
     /**
      * Close the <code>OutputHandler</code>.
      * @throws IOException

Modified: pig/branches/tez/src/org/apache/pig/impl/util/CastUtils.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/util/CastUtils.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/util/CastUtils.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/util/CastUtils.java Thu Oct  3 23:24:40 2013
@@ -59,7 +59,7 @@ public class CastUtils {
 	    case (DataType.LONG): return caster.bytesToLong(bytes);
 	    case (DataType.BOOLEAN): return caster.bytesToBoolean(bytes);
 	    case (DataType.DATETIME): return caster.bytesToDateTime(bytes);
-	    case (DataType.MAP): return caster.bytesToMap(bytes);
+	    case (DataType.MAP): return caster.bytesToMap(bytes, fieldSchema);
 	    case (DataType.TUPLE): return caster.bytesToTuple(bytes, fieldSchema);
 	    default: throw new IOException("Unknown type " + dataType);
 	    }

Modified: pig/branches/tez/src/org/apache/pig/impl/util/JarManager.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/util/JarManager.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/util/JarManager.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/util/JarManager.java Thu Oct  3 23:24:40 2013
@@ -42,8 +42,10 @@ import java.util.zip.ZipEntry;
 import org.antlr.runtime.CommonTokenStream;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.pig.backend.hadoop.executionengine.Launcher;
 import org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigMapReduce;
 import org.apache.pig.impl.PigContext;
+import org.apache.pig.impl.builtin.StreamingUDF;
 import org.apache.tools.bzip2r.BZip2Constants;
 import org.codehaus.jackson.annotate.JsonPropertyOrder;
 import org.codehaus.jackson.map.annotate.JacksonStdImpl;
@@ -132,7 +134,10 @@ public class JarManager {
      */
     @SuppressWarnings("deprecation")
     public static void createJar(OutputStream os, Set<String> funcs, PigContext pigContext) throws ClassNotFoundException, IOException {
+        JarOutputStream jarFile = new JarOutputStream(os);
+        HashMap<String, String> contents = new HashMap<String, String>();
         Vector<JarListEntry> jarList = new Vector<JarListEntry>();
+
         for (DefaultPigPackages pkgToSend : DefaultPigPackages.values()) {
             addContainingJar(jarList, pkgToSend.getPkgClass(), pkgToSend.getPkgPrefix(), pigContext);
         }
@@ -141,10 +146,16 @@ public class JarManager {
             Class clazz = pigContext.getClassForAlias(func);
             if (clazz != null) {
                 addContainingJar(jarList, clazz, null, pigContext);
+                
+                if (clazz.getSimpleName().equals("StreamingUDF")) {
+                    for (String fileName : StreamingUDF.getResourcesForJar()) {
+                        InputStream in = Launcher.class.getResourceAsStream(fileName);
+                        addStream(jarFile, fileName, in, contents);
+                    }
+                }
             }
         }
-        HashMap<String, String> contents = new HashMap<String, String>();
-        JarOutputStream jarFile = new JarOutputStream(os);
+
         Iterator<JarListEntry> it = jarList.iterator();
         while (it.hasNext()) {
             JarListEntry jarEntry = it.next();

Modified: pig/branches/tez/src/org/apache/pig/impl/util/StorageUtil.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/impl/util/StorageUtil.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/impl/util/StorageUtil.java (original)
+++ pig/branches/tez/src/org/apache/pig/impl/util/StorageUtil.java Thu Oct  3 23:24:40 2013
@@ -21,12 +21,12 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
-import org.joda.time.DateTime;
-
 import org.apache.hadoop.io.Text;
 import org.apache.pig.PigException;
 import org.apache.pig.backend.executionengine.ExecException;
@@ -37,6 +37,10 @@ import org.apache.pig.data.DataByteArray
 import org.apache.pig.data.DataType;
 import org.apache.pig.data.Tuple;
 import org.apache.pig.data.TupleFactory;
+import org.apache.pig.impl.streaming.StreamingDelimiters;
+import org.joda.time.DateTime;
+
+import com.google.common.base.Charsets;
 
 /**
  * This util class provides methods that are shared by storage class
@@ -44,9 +48,23 @@ import org.apache.pig.data.TupleFactory;
  *
  */
 public final class StorageUtil {
-
-    private static final String UTF8 = "UTF-8";
-
+    private static Map<Byte, byte[]> TYPE_INDICATOR;
+    static {
+        TYPE_INDICATOR = new HashMap<Byte, byte[]>();
+        TYPE_INDICATOR.put(DataType.BOOLEAN, new byte[] {'B'});
+        TYPE_INDICATOR.put(DataType.INTEGER, new byte[] {'I'});
+        TYPE_INDICATOR.put(DataType.LONG, new byte[] {'L'});
+        TYPE_INDICATOR.put(DataType.FLOAT, new byte[] {'F'});
+        TYPE_INDICATOR.put(DataType.DOUBLE, new byte[] {'D'});
+        TYPE_INDICATOR.put(DataType.BYTEARRAY, new byte[] {'A'});
+        TYPE_INDICATOR.put(DataType.CHARARRAY, new byte[] {'C'});
+        TYPE_INDICATOR.put(DataType.DATETIME, new byte[] {'T'});
+        TYPE_INDICATOR.put(DataType.BIGINTEGER, new byte[] {'N'});
+        TYPE_INDICATOR.put(DataType.BIGDECIMAL, new byte[] {'E'});
+    }
+    
+    public static final StreamingDelimiters DEFAULT_DELIMITERS = new StreamingDelimiters();
+    
     /**
      * Transform a <code>String</code> into a byte representing the
      * field delimiter.
@@ -94,6 +112,14 @@ public final class StorageUtil {
         return fieldDel;
     }
 
+    public static void putField(OutputStream out, Object field) throws IOException {
+        putField(out, field, DEFAULT_DELIMITERS, false);
+    }
+    
+    public static void putField(OutputStream out, Object field, boolean includeTypeInformation) throws IOException {
+        putField(out, field, DEFAULT_DELIMITERS, includeTypeInformation);
+    }
+    
     /**
      * Serialize an object to an {@link OutputStream} in the
      * field-delimited form.
@@ -103,113 +129,112 @@ public final class StorageUtil {
      * @throws IOException if serialization fails.
      */
     @SuppressWarnings("unchecked")
-    public static void putField(OutputStream out, Object field)
+    public static void putField(OutputStream out, Object field, StreamingDelimiters delims, boolean includeTypeInformation)
     throws IOException {
-        //string constants for each delimiter
-        String tupleBeginDelim = "(";
-        String tupleEndDelim = ")";
-        String bagBeginDelim = "{";
-        String bagEndDelim = "}";
-        String mapBeginDelim = "[";
-        String mapEndDelim = "]";
-        String fieldDelim = ",";
-        String mapKeyValueDelim = "#";
-
         switch (DataType.findType(field)) {
         case DataType.NULL:
-            break; // just leave it empty
+            out.write(delims.getNull());
+            break;
 
         case DataType.BOOLEAN:
-            out.write(((Boolean)field).toString().getBytes());
+            writeField(out, ((Boolean)field).toString().getBytes(Charset.defaultCharset()), 
+                    DataType.BOOLEAN, includeTypeInformation);
             break;
 
         case DataType.INTEGER:
-            out.write(((Integer)field).toString().getBytes());
+            writeField(out, ((Integer)field).toString().getBytes(Charset.defaultCharset()), 
+                    DataType.INTEGER, includeTypeInformation);
             break;
 
         case DataType.LONG:
-            out.write(((Long)field).toString().getBytes());
+            writeField(out, ((Long)field).toString().getBytes(Charset.defaultCharset()), 
+                    DataType.LONG, includeTypeInformation);
             break;
 
         case DataType.FLOAT:
-            out.write(((Float)field).toString().getBytes());
+            writeField(out, ((Float)field).toString().getBytes(Charset.defaultCharset()), 
+                    DataType.FLOAT, includeTypeInformation);
             break;
 
         case DataType.DOUBLE:
-            out.write(((Double)field).toString().getBytes());
+            writeField(out, ((Double)field).toString().getBytes(Charset.defaultCharset()), 
+                    DataType.DOUBLE, includeTypeInformation);
             break;
 
         case DataType.BIGINTEGER:
-            out.write(((BigInteger)field).toString().getBytes());
+            writeField(out, ((BigInteger)field).toString().getBytes(Charset.defaultCharset()),
+                    DataType.BIGINTEGER, includeTypeInformation);
             break;
 
         case DataType.BIGDECIMAL:
-            out.write(((BigDecimal)field).toString().getBytes());
+            writeField(out, ((BigDecimal)field).toString().getBytes(Charset.defaultCharset()),
+                    DataType.BIGDECIMAL, includeTypeInformation);
             break;
 
         case DataType.DATETIME:
-            out.write(((DateTime)field).toString().getBytes());
+            writeField(out, ((DateTime)field).toString().getBytes(Charset.defaultCharset()),
+                    DataType.DATETIME, includeTypeInformation);
             break;
 
         case DataType.BYTEARRAY:
-            byte[] b = ((DataByteArray)field).get();
-            out.write(b, 0, b.length);
+            writeField(out, ((DataByteArray)field).get(), 
+                    DataType.BYTEARRAY, includeTypeInformation);
             break;
 
         case DataType.CHARARRAY:
-            // oddly enough, writeBytes writes a string
-            out.write(((String)field).getBytes(UTF8));
+            writeField(out, ((String)field).getBytes(Charsets.UTF_8), 
+                    DataType.CHARARRAY, includeTypeInformation);
             break;
 
         case DataType.MAP:
             boolean mapHasNext = false;
             Map<String, Object> m = (Map<String, Object>)field;
-            out.write(mapBeginDelim.getBytes(UTF8));
+            out.write(delims.getMapBegin());
             for(Map.Entry<String, Object> e: m.entrySet()) {
                 if(mapHasNext) {
-                    out.write(fieldDelim.getBytes(UTF8));
+                    out.write(delims.getFieldDelim());
                 } else {
                     mapHasNext = true;
                 }
-                putField(out, e.getKey());
-                out.write(mapKeyValueDelim.getBytes(UTF8));
-                putField(out, e.getValue());
+                putField(out, e.getKey(), delims, includeTypeInformation);
+                out.write(delims.getMapKeyDelim());
+                putField(out, e.getValue(), delims, includeTypeInformation);
             }
-            out.write(mapEndDelim.getBytes(UTF8));
+            out.write(delims.getMapEnd());
             break;
 
         case DataType.TUPLE:
             boolean tupleHasNext = false;
             Tuple t = (Tuple)field;
-            out.write(tupleBeginDelim.getBytes(UTF8));
+            out.write(delims.getTupleBegin());
             for(int i = 0; i < t.size(); ++i) {
                 if(tupleHasNext) {
-                    out.write(fieldDelim.getBytes(UTF8));
+                    out.write(delims.getFieldDelim());
                 } else {
                     tupleHasNext = true;
                 }
                 try {
-                    putField(out, t.get(i));
+                    putField(out, t.get(i), delims, includeTypeInformation);
                 } catch (ExecException ee) {
                     throw ee;
                 }
             }
-            out.write(tupleEndDelim.getBytes(UTF8));
+            out.write(delims.getTupleEnd());
             break;
 
         case DataType.BAG:
             boolean bagHasNext = false;
-            out.write(bagBeginDelim.getBytes(UTF8));
+            out.write(delims.getBagBegin());
             Iterator<Tuple> tupleIter = ((DataBag)field).iterator();
             while(tupleIter.hasNext()) {
                 if(bagHasNext) {
-                    out.write(fieldDelim.getBytes(UTF8));
+                    out.write(delims.getFieldDelim());
                 } else {
                     bagHasNext = true;
                 }
-                putField(out, (Object)tupleIter.next());
+                putField(out, (Object)tupleIter.next(), delims, includeTypeInformation);
             }
-            out.write(bagEndDelim.getBytes(UTF8));
+            out.write(delims.getBagEnd());
             break;
 
         default: {
@@ -220,6 +245,14 @@ public final class StorageUtil {
 
         }
     }
+    
+    private static void writeField(OutputStream out, byte[] bytes, byte dataType, 
+            boolean includeTypeInformation) throws IOException {
+        if (includeTypeInformation) {
+            out.write(TYPE_INDICATOR.get(dataType));
+        }
+        out.write(bytes);
+    }
 
     /**
      * Transform a line of <code>Text</code> to a <code>Tuple</code>
@@ -260,7 +293,7 @@ public final class StorageUtil {
 
         return TupleFactory.getInstance().newTupleNoCopy(protoTuple);
     }
-
+    
     //---------------------------------------------------------------
     // private methods
 

Modified: pig/branches/tez/src/org/apache/pig/newplan/PColFilterExtractor.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/newplan/PColFilterExtractor.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/newplan/PColFilterExtractor.java (original)
+++ pig/branches/tez/src/org/apache/pig/newplan/PColFilterExtractor.java Thu Oct  3 23:24:40 2013
@@ -64,6 +64,7 @@ import org.apache.pig.newplan.DepthFirst
  * The condition on partition cols will be used to prune partitions of the table.
  *
  */
+@Deprecated
 public class PColFilterExtractor extends PlanVisitor {
 
     private static final Log LOG = LogFactory.getLog(PColFilterExtractor.class);

Modified: pig/branches/tez/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java (original)
+++ pig/branches/tez/src/org/apache/pig/newplan/logical/optimizer/LogicalPlanOptimizer.java Thu Oct  3 23:24:40 2013
@@ -75,9 +75,8 @@ public class LogicalPlanOptimizer extend
     }
 
     protected List<Set<Rule>> buildRuleSets() {
-        List<Set<Rule>> ls = new ArrayList<Set<Rule>>();	    
+        List<Set<Rule>> ls = new ArrayList<Set<Rule>>();
 
-        
         // ImplicitSplitInserter set
         // This set of rules Insert Foreach dedicated for casting after load
         Set<Rule> s = new HashSet<Rule>();
@@ -94,7 +93,18 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
+        // Partition filter set
+        // This set of rules push partition filter to LoadFunc
+        // Important: do this before LogicalExpressionSimplifier so that size of filter can be reduced
+        // (However, its not necessary to do it before LogicalExpressionSimplifier)
+        s = new HashSet<Rule>();
+        // Optimize partition filter
+        r = new PartitionFilterOptimizer("NewPartitionFilterOptimizer");
+        checkAndAddRule(s, r);
+        if (!s.isEmpty())
+            ls.add(s);
+
         // Logical expression simplifier
         s = new HashSet<Rule>();
         // add logical expression simplification rule
@@ -112,7 +122,7 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // Split Set
         // This set of rules does splitting of operators only.
         // It does not move operators
@@ -122,8 +132,8 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
-        
+
+
         // Push Set,
         // This set does moving of operators only.
         s = new HashSet<Rule>();
@@ -133,17 +143,17 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // Merge Set
         // This Set merges operators but does not move them.
         s = new HashSet<Rule>();
         checkAndAddRule(s, r);
         // add merge filter rule
-        r = new MergeFilter("MergeFilter");        
+        r = new MergeFilter("MergeFilter");
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // Partition filter set
         // This set of rules push partition filter to LoadFunc
         s = new HashSet<Rule>();
@@ -152,7 +162,7 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // PushDownForEachFlatten set
         s = new HashSet<Rule>();
         // Add the PushDownForEachFlatten
@@ -160,7 +170,7 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // Prune Set
         // This set is used for pruning columns and maps
         s = new HashSet<Rule>();
@@ -169,7 +179,7 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // Add LOForEach set
         s = new HashSet<Rule>();
         // Add the AddForEach
@@ -177,7 +187,7 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         // Add MergeForEach set
         s = new HashSet<Rule>();
         // Add the AddForEach
@@ -185,14 +195,14 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         //set parallism to 1 for cogroup/group-by on constant
         s = new HashSet<Rule>();
         r = new GroupByConstParallelSetter("GroupByConstParallelSetter");
         checkAndAddRule(s, r);
         if(!s.isEmpty())
             ls.add(s);
-        
+
         // Limit Set
         // This set of rules push up limit
         s = new HashSet<Rule>();
@@ -201,7 +211,7 @@ public class LogicalPlanOptimizer extend
         checkAndAddRule(s, r);
         if (!s.isEmpty())
             ls.add(s);
-        
+
         return ls;
     }
 

Modified: pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOCross.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOCross.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOCross.java (original)
+++ pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOCross.java Thu Oct  3 23:24:40 2013
@@ -78,6 +78,10 @@ public class LOCross extends LogicalRela
             }            
         }        
 
+        if (nested) {
+            LogicalRelationalOperator.fixDuplicateUids(fss);
+        }
+
         schema = new LogicalSchema();
         for(LogicalSchema.LogicalFieldSchema fieldSchema: fss) {
             schema.addField(fieldSchema);

Modified: pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOLoad.java
URL: http://svn.apache.org/viewvc/pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOLoad.java?rev=1529033&r1=1529032&r2=1529033&view=diff
==============================================================================
--- pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOLoad.java (original)
+++ pig/branches/tez/src/org/apache/pig/newplan/logical/relational/LOLoad.java Thu Oct  3 23:24:40 2013
@@ -39,14 +39,14 @@ import org.apache.pig.newplan.PlanVisito
 import org.apache.pig.newplan.logical.Util;
 
 public class LOLoad extends LogicalRelationalOperator {
-    
+    public enum CastState {INSERTED, NONEED, NOADJUST};
     private LogicalSchema scriptSchema;
     private final FileSpec fs;
     private transient LoadFunc loadFunc;
     transient private Configuration conf;
     private final LogicalSchema determinedSchema;
     private List<Integer> requiredFields = null;
-    private boolean castInserted = false;
+    private CastState castState = CastState.NOADJUST;
     private LogicalSchema uidOnlySchema;
     private final String schemaFile;
     private final String signature;
@@ -139,7 +139,7 @@ public class LOLoad extends LogicalRelat
         } else if (scriptSchema != null)  originalSchema = scriptSchema;
         else if (determinedSchema != null) originalSchema = determinedSchema;
         
-        if (isCastInserted()) {
+        if (isCastAdjusted()) {
             for (int i=0;i<originalSchema.size();i++) {
                 LogicalSchema.LogicalFieldSchema fs = originalSchema.getField(i);
                 if(determinedSchema == null) {
@@ -254,12 +254,16 @@ public class LOLoad extends LogicalRelat
         }
     }
     
-    public void setCastInserted(boolean flag) {
-        castInserted = flag;
+    public void setCastState(CastState state) {
+        castState = state;
+    }
+    
+    public CastState getCastState() {
+        return castState;
     }
     
-    public boolean isCastInserted() {
-        return castInserted;
+    public boolean isCastAdjusted() {
+        return castState!=CastState.NOADJUST;
     }
     
     public Configuration getConfiguration() {