Author: olga
Date: Tue Apr 29 13:26:14 2008
New Revision: 652088

URL: http://svn.apache.org/viewvc?rev=652088&view=rev
Log:
PIG-151: fix for bzip files

Modified:
    incubator/pig/trunk/CHANGES.txt
    
incubator/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2OutputStream.java
    
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigOutputFormat.java

Modified: incubator/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=652088&r1=652087&r2=652088&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Tue Apr 29 13:26:14 2008
@@ -253,3 +253,5 @@
     PIG-218: Fixed param generation to work with arbitrary commands
 
     PIG-220: Fixed definition of parameter name for param substitution
+
+    PIG-151: fixes to code that handles bzip files

Modified: 
incubator/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2OutputStream.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2OutputStream.java?rev=652088&r1=652087&r2=652088&view=diff
==============================================================================
--- 
incubator/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2OutputStream.java
 (original)
+++ 
incubator/pig/trunk/lib-src/bzip2/org/apache/tools/bzip2r/CBZip2OutputStream.java
 Tue Apr 29 13:26:14 2008
@@ -424,6 +424,11 @@
         super.finalize();
     }
 
+    // The bytes to fillin an empty file
+    final private static byte emptyFileArray[] = {
+        0x39, 0x17, 0x72, 0x45, 0x38, 0x50, (byte) 0x90, 00, 00, 00, 00
+    };
+    
     public void close() throws IOException {
         if (closed) {
             return;
@@ -436,6 +441,8 @@
         if (written){
                endBlock();
                endCompression();
+        } else {
+            bsStream.write(emptyFileArray);
         }
         closed = true;
         super.close();

Modified: 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigOutputFormat.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigOutputFormat.java?rev=652088&r1=652087&r2=652088&view=diff
==============================================================================
--- 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigOutputFormat.java
 (original)
+++ 
incubator/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/mapreduceExec/PigOutputFormat.java
 Tue Apr 29 13:26:14 2008
@@ -56,7 +56,12 @@
         } else {
             store = (StoreFunc) PigContext.instantiateFuncFromSpec(storeFunc);
         }
-        String parentName = outputDir.getParent().getName();
+        // The outputDir is going to be a temporary name we need to look at the
+        // real thing!
+        // XXX This is a wretched implementation dependent hack! Need to find
+        // out from the Hadoop guys if there is a better way.
+        String parentName = job.getOutputPath().getParent().getParent()
+                .getName();
         int suffixStart = parentName.lastIndexOf('.');
         if (suffixStart != -1) {
             String suffix = parentName.substring(suffixStart);


Reply via email to