You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2014/10/31 07:45:58 UTC

svn commit: r1635697 - in /pig/branches/branch-0.14: CHANGES.txt src/org/apache/pig/impl/builtin/StreamingUDF.java src/python/streaming/controller.py

Author: daijy
Date: Fri Oct 31 06:45:57 2014
New Revision: 1635697

URL: http://svn.apache.org/r1635697
Log:
PIG-4256: Fix StreamingPythonUDFs e2e test failure on Windows

Modified:
    pig/branches/branch-0.14/CHANGES.txt
    pig/branches/branch-0.14/src/org/apache/pig/impl/builtin/StreamingUDF.java
    pig/branches/branch-0.14/src/python/streaming/controller.py

Modified: pig/branches/branch-0.14/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/CHANGES.txt?rev=1635697&r1=1635696&r2=1635697&view=diff
==============================================================================
--- pig/branches/branch-0.14/CHANGES.txt (original)
+++ pig/branches/branch-0.14/CHANGES.txt Fri Oct 31 06:45:57 2014
@@ -95,6 +95,8 @@ OPTIMIZATIONS
  
 BUG FIXES
 
+PIG-4256: Fix StreamingPythonUDFs e2e test failure on Windows (daijy)
+
 PIG-4253: Add a SequenceID UDF (daijy)
 
 PIG-4166: Collected group drops last record when combined with merge join (bridiver via daijy)

Modified: pig/branches/branch-0.14/src/org/apache/pig/impl/builtin/StreamingUDF.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/src/org/apache/pig/impl/builtin/StreamingUDF.java?rev=1635697&r1=1635696&r2=1635697&view=diff
==============================================================================
--- pig/branches/branch-0.14/src/org/apache/pig/impl/builtin/StreamingUDF.java (original)
+++ pig/branches/branch-0.14/src/org/apache/pig/impl/builtin/StreamingUDF.java Fri Oct 31 06:45:57 2014
@@ -206,7 +206,7 @@ public class StreamingUDF extends EvalFu
                 filePath.substring(0, lastSeparator - 1);
         command[UDF_NAME] = funcName;
         String fileCachePath = jobDir + filePath.substring(0, lastSeparator);
-        command[PATH_TO_FILE_CACHE] = "\"" + fileCachePath + "\"";
+        command[PATH_TO_FILE_CACHE] = "'" + fileCachePath + "'";
         command[STD_OUT_OUTPUT_PATH] = outFileName;
         command[STD_ERR_OUTPUT_PATH] = errOutFileName;
         command[CONTROLLER_LOG_FILE_PATH] = controllerLogFileName;
@@ -227,7 +227,8 @@ public class StreamingUDF extends EvalFu
 
         File userUdfFile = new File(fileCachePath + command[UDF_FILE_NAME] + getUserFileExtension());
         if (!userUdfFile.exists()) {
-            String absolutePath = filePath.startsWith("/") ? filePath : File.separator + filePath;
+            String absolutePath = filePath.startsWith("/") ? filePath : "/" + filePath;
+            absolutePath = absolutePath.replaceAll(":", "");
             String controllerDir = new File(command[PATH_TO_CONTROLLER_FILE]).getParent();
             String userUdfPath = controllerDir + absolutePath + getUserFileExtension();
             userUdfFile = new File(userUdfPath);

Modified: pig/branches/branch-0.14/src/python/streaming/controller.py
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.14/src/python/streaming/controller.py?rev=1635697&r1=1635696&r2=1635697&view=diff
==============================================================================
--- pig/branches/branch-0.14/src/python/streaming/controller.py (original)
+++ pig/branches/branch-0.14/src/python/streaming/controller.py Fri Oct 31 06:45:57 2014
@@ -96,7 +96,7 @@ class PythonStreamingController:
 
         if is_illustrate or udf_logging.udf_log_level != logging.DEBUG:
             #Only log output for illustrate after we get the flag to capture output.
-            sys.stdout = open("/dev/null", 'w')
+            sys.stdout = open(os.devnull, 'w')
         else:
             sys.stdout = self.output_stream