pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From the...@apache.org
Subject svn commit: r1214495 - in /pig/trunk: CHANGES.txt src/org/apache/pig/builtin/BinStorage.java test/org/apache/pig/test/TestBuiltin.java
Date Wed, 14 Dec 2011 21:46:51 GMT
Author: thejas
Date: Wed Dec 14 21:46:50 2011
New Revision: 1214495

URL: http://svn.apache.org/viewvc?rev=1214495&view=rev
Log:
PIG-2331: BinStorage in LOAD statement failing when input has curly braces (xutingz via thejas)

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

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1214495&r1=1214494&r2=1214495&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Wed Dec 14 21:46:50 2011
@@ -192,6 +192,8 @@ PIG-2228: support partial aggregation in
 
 BUG FIXES
 
+PIG-2331: BinStorage in LOAD statement failing when input has curly braces (xutingz via thejas)
+
 PIG-2391: Bzip_2 test is broken (xutingz via daijy)
 
 PIG-2358: JobStats.getHadoopCounters() is never set and always returns null (xutingz via
daijy)

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=1214495&r1=1214494&r2=1214495&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/builtin/BinStorage.java (original)
+++ pig/trunk/src/org/apache/pig/builtin/BinStorage.java Wed Dec 14 21:46:50 2011
@@ -390,8 +390,8 @@ implements StoreFuncInterface, LoadMetad
             // we can use HDataStorage and FileLocalizer.openDFSFile below
             HDataStorage storage;
             try {
-                storage = new HDataStorage(new URI(loc), props);
-            } catch (URISyntaxException e) {
+            	storage = new HDataStorage((new org.apache.hadoop.fs.Path(loc)).toUri(), props);
+            } catch (RuntimeException e) {
                 throw new IOException(e);
             }
             if (!FileLocalizer.fileExists(loc, storage)) {

Modified: pig/trunk/test/org/apache/pig/test/TestBuiltin.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestBuiltin.java?rev=1214495&r1=1214494&r2=1214495&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestBuiltin.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestBuiltin.java Wed Dec 14 21:46:50 2011
@@ -2401,6 +2401,34 @@ public class TestBuiltin {
         assertEquals(2, result.size());
     }
     
+    //see PIG-2331
+    @Test
+    public void testURIwithCurlyBrace() throws Exception {
+        String inputFileName = "input.txt";
+        String inputFileName1 ="part-1";
+        String[] inputData = new String[] {
+                "1",
+                "a",
+                "r"};
+        Util.createInputFile(cluster, inputFileName, inputData);
+
+         try {
+             pigServer.registerQuery("a = load '" + inputFileName + "'AS (s:chararray);");
+             pigServer.store("a", inputFileName1, "BinStorage");
+             pigServer.registerQuery("b = load 'part-{1,2}' using BinStorage() AS (s:chararray);");
+             Iterator<Tuple> it = pigServer.openIterator("b");
+             int i=0;
+             while(it.hasNext())
+             {
+            	 assertTrue(it.next().get(0).equals(inputData[i]));
+            	 i++;
+             }
+             assertTrue(i==3);
+         }catch(Exception e) {
+         }finally {
+             Util.deleteFile(cluster, inputFileName);
+         }
+    }
     private static String getInputType(String typeFor) {
         return allowedInput.get(typeFor);
     }



Mime
View raw message