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 2011/04/25 23:07:41 UTC

svn commit: r1096603 - in /pig/trunk: CHANGES.txt src/org/apache/pig/builtin/BinStorage.java

Author: daijy
Date: Mon Apr 25 21:07:40 2011
New Revision: 1096603

URL: http://svn.apache.org/viewvc?rev=1096603&view=rev
Log:
PIG-1865: BinStorage/PigStorageSchema cannot load data from a different namenode

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/builtin/BinStorage.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1096603&r1=1096602&r2=1096603&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Mon Apr 25 21:07:40 2011
@@ -180,6 +180,8 @@ PIG-1696: Performance: Use System.arrayc
 
 BUG FIXES
 
+PIG-1865: BinStorage/PigStorageSchema cannot load data from a different namenode (daijy)
+
 PIG-1910: incorrect schema shown when project-star is used with other projections (daijy)
 
 PIG-2005: Discrepancy in the way dry run handles semicolon in macro definition (rding)

Modified: pig/trunk/src/org/apache/pig/builtin/BinStorage.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/builtin/BinStorage.java?rev=1096603&r1=1096602&r2=1096603&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/BinStorage.java (original)
+++ pig/trunk/src/org/apache/pig/builtin/BinStorage.java Mon Apr 25 21:07:40 2011
@@ -22,6 +22,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
@@ -359,16 +361,21 @@ implements StoreFuncInterface, LoadMetad
             throws IOException {
         Configuration conf = job.getConfiguration();
         Properties props = ConfigurationUtil.toProperties(conf);
-        // since local mode now is implemented as hadoop's local mode
-        // we can treat either local or hadoop mode as hadoop mode - hence
-        // we can use HDataStorage and FileLocalizer.openDFSFile below
-        HDataStorage storage = new HDataStorage(props);
         
         // At compile time in batch mode, the file may not exist
         // (such as intermediate file). Just return null - the
         // same way as we would if we did not get a valid record
         String[] locations = getPathStrings(location);
         for (String loc : locations) {
+            // since local mode now is implemented as hadoop's local mode
+            // we can treat either local or hadoop mode as hadoop mode - hence
+            // we can use HDataStorage and FileLocalizer.openDFSFile below
+            HDataStorage storage;
+            try {
+                storage = new HDataStorage(new URI(loc), props);
+            } catch (URISyntaxException e) {
+                throw new IOException(e);
+            }
             if (!FileLocalizer.fileExists(loc, storage)) {
                 return null;
             }