pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1404353 - in /pig/trunk: ./ test/org/apache/pig/test/
Date Wed, 31 Oct 2012 21:12:27 GMT
Author: daijy
Date: Wed Oct 31 21:12:26 2012
New Revision: 1404353

URL: http://svn.apache.org/viewvc?rev=1404353&view=rev
Log:
PIG-2795: Fix test cases that generate pig scripts with "load " + pathStr to encode "\" in
the path (jgordon via daijy)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/test/org/apache/pig/test/TestAlgebraicEvalLocal.java
    pig/trunk/test/org/apache/pig/test/TestCommit.java
    pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java
    pig/trunk/test/org/apache/pig/test/TestEvalPipelineLocal.java
    pig/trunk/test/org/apache/pig/test/TestForEachNestedPlanLocal.java
    pig/trunk/test/org/apache/pig/test/TestLOLoadDeterminedSchema.java
    pig/trunk/test/org/apache/pig/test/TestLocal.java
    pig/trunk/test/org/apache/pig/test/TestLocal2.java
    pig/trunk/test/org/apache/pig/test/TestSplitIndex.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Wed Oct 31 21:12:26 2012
@@ -517,13 +517,19 @@ PIG-2379: Bug in Schema.getPigSchema(Res
 
 PIG-2355: ant clean does not clean e2e test build artifacts (daijy)
 
-	PIG-2352: e2e test harness' use of environment variables causes unintended effects between
tests (gates)
+PIG-2352: e2e test harness' use of environment variables causes unintended effects between
tests (gates)
 
-	Release 0.10.0 - Unreleased
+Release 0.10.1 - Unreleased
 
-	INCOMPATIBLE CHANGES
+BUG FIXES
+
+PIG-2795: Fix test cases that generate pig scripts with "load " + pathStr to encode "\" in
the path (jgordon via daijy)
+
+Release 0.10.0
 
-	IMPROVEMENTS
+INCOMPATIBLE CHANGES
+
+IMPROVEMENTS
 
 PIG-2664: Allow PPNL impls to get more job info during the run (billgraham)
 

Modified: pig/trunk/test/org/apache/pig/test/TestAlgebraicEvalLocal.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestAlgebraicEvalLocal.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestAlgebraicEvalLocal.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestAlgebraicEvalLocal.java Wed Oct 31 21:12:26 2012
@@ -94,7 +94,7 @@ public class TestAlgebraicEvalLocal exte
                 ps.close();                
             }
             pig.registerQuery(" a = group (load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "') by ($0,$1);");
             pig.registerQuery("b = foreach a generate flatten(group), SUM($1.$2);");
             Iterator<Tuple> it = pig.openIterator("b");
@@ -143,7 +143,7 @@ public class TestAlgebraicEvalLocal exte
             PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
             generateInput(ps, nullFlags[i]);
             String query = "myid =  foreach (group (load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "') all) generate COUNT($1);";
             System.out.println(query);
             pig.registerQuery(query);
@@ -165,7 +165,7 @@ public class TestAlgebraicEvalLocal exte
             PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
             generateInput(ps, nullFlags[i]);
             String query = "myid = foreach (group (load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "') all) generate group, COUNT($1) ;";
             System.out.println(query);
             pig.registerQuery(query);
@@ -186,7 +186,7 @@ public class TestAlgebraicEvalLocal exte
             PrintStream ps = new PrintStream(new FileOutputStream(tmpFile));
             generateInput(ps, nullFlags[i]);
             String query = "myid = foreach (group (load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "') all) generate COUNT($1), group ;";
             System.out.println(query);
             pig.registerQuery(query);
@@ -229,7 +229,7 @@ public class TestAlgebraicEvalLocal exte
             }         
             ps.close();
             String query = "myid = foreach (group (load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "' using " + PigStorage.class.getName()
                     + "(':')) by $0) generate group, COUNT($1.$1) ;";
             System.out.println(query);
@@ -280,7 +280,7 @@ public class TestAlgebraicEvalLocal exte
             }
             ps.close();
             String query = "myid = foreach (group (load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "' using "
                     + PigStorage.class.getName()
                     + "(':')) by $0) generate group, COUNT($1.$1), COUNT($1.$0) ;";

Modified: pig/trunk/test/org/apache/pig/test/TestCommit.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestCommit.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestCommit.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestCommit.java Wed Oct 31 21:12:26 2012
@@ -54,8 +54,8 @@ public class TestCommit {
         File studentFile = Util.createInputFile("tmp", "student", new String[]{"joe smith:18:3.5","amy
brown:25:2.5","jim fox:20:4.0","leo fu:55:3.0"});
         File voterFile = Util.createInputFile("tmp", "voter", new String[]{"amy brown,25,democrat,25.50","amy
brown,25,democrat,100","jim fox,20,independent,50.0"});
 
-        pigServer.registerQuery("a = load '" + studentFile.getAbsolutePath() + "' using "
+ PigStorage.class.getName() + "(':') as (name, age, gpa);");
-        pigServer.registerQuery("b = load '" + voterFile.getAbsolutePath() + "' using " +
PigStorage.class.getName() + "(',') as (name, age, registration, contributions);");
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(studentFile.getAbsolutePath())
+ "' using " + PigStorage.class.getName() + "(':') as (name, age, gpa);");
+        pigServer.registerQuery("b = load '" + Util.encodeEscape(voterFile.getAbsolutePath())
+ "' using " + PigStorage.class.getName() + "(',') as (name, age, registration, contributions);");
         pigServer.registerQuery("c = filter a by age < 50;");
         pigServer.registerQuery("d = filter b by age < 50;");
         pigServer.registerQuery("e = cogroup c by (name, age), d by (name, age);");
@@ -94,7 +94,7 @@ public class TestCommit {
         expected2.set(2, "leo fu");
         expected2.set(3, 55);
 
-        pigServer.registerQuery("a = load '" + testFile.getAbsolutePath() + "' using " +
PigStorage.class.getName() + "(':') as (name: chararray, age: int, gpa: float);");
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(testFile.getAbsolutePath())
+ "' using " + PigStorage.class.getName() + "(':') as (name: chararray, age: int, gpa: float);");
         pigServer.registerQuery("b = group a by age;");
         pigServer.registerQuery("c = foreach b { d = filter a by gpa > 2.5;  " +
                                 "e = order a by name; f = a.age; g = distinct f; " +

Modified: pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestEvalPipeline2.java Wed Oct 31 21:12:26 2012
@@ -349,7 +349,7 @@ public class TestEvalPipeline2 {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "' AS (num:int);");
         pigServer.registerQuery("B = order A by num parallel 2;");
         pigServer.registerQuery("C = limit B 10;");
@@ -378,7 +378,7 @@ public class TestEvalPipeline2 {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "' AS (num:int);");
         pigServer.registerQuery("B = order A by num parallel 2;");
         pigServer.registerQuery("C = limit B 10;");
@@ -411,7 +411,7 @@ public class TestEvalPipeline2 {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "' AS (num:int);");
         pigServer.registerQuery("B = order A by num desc parallel 2;");
         pigServer.registerQuery("C = limit B 10;");
@@ -458,8 +458,8 @@ public class TestEvalPipeline2 {
         ps2.println("2\t2");
         ps2.close();
 
-        pigServer.registerQuery("A = LOAD '" + Util.generateURI(tmpFile1.toString(), pigServer.getPigContext())
+ "' AS (a0, a1, a2);");
-        pigServer.registerQuery("B = LOAD '" + Util.generateURI(tmpFile2.toString(), pigServer.getPigContext())
+ "' AS (b0, b1);");
+        pigServer.registerQuery("A = LOAD '" + Util.generateURI(Util.encodeEscape(tmpFile1.toString()),
pigServer.getPigContext()) + "' AS (a0, a1, a2);");
+        pigServer.registerQuery("B = LOAD '" + Util.generateURI(Util.encodeEscape(tmpFile2.toString()),
pigServer.getPigContext()) + "' AS (b0, b1);");
         pigServer.registerQuery("C = LIMIT B 100;");
         pigServer.registerQuery("D = COGROUP C BY b0, A BY a0 PARALLEL 2;");
         Iterator<Tuple> iter = pigServer.openIterator("D");

Modified: pig/trunk/test/org/apache/pig/test/TestEvalPipelineLocal.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestEvalPipelineLocal.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestEvalPipelineLocal.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestEvalPipelineLocal.java Wed Oct 31 21:12:26 2012
@@ -107,7 +107,7 @@ public class TestEvalPipelineLocal {
         File f1 = createFile(new String[]{"a:1","b:1","a:1"});
 
         pigServer.registerQuery("a = load '"
-                + Util.generateURI(f1.toString(), pigServer.getPigContext())
+                + Util.generateURI(Util.encodeEscape(f1.toString()), pigServer.getPigContext())
                 + "' using " + PigStorage.class.getName() + "(':');");
         pigServer.registerQuery("b = foreach a generate 1-1/1;");
         Iterator<Tuple> iter  = pigServer.openIterator("b");
@@ -125,10 +125,10 @@ public class TestEvalPipelineLocal {
         File f2 = createFile(new String[]{"b","b","a"});
         
         pigServer.registerQuery("a = load '"
-                + Util.generateURI(f1.toString(), pigServer.getPigContext())
+                + Util.generateURI(Util.encodeEscape(f1.toString()), pigServer.getPigContext())
                 + "' using " + PigStorage.class.getName() + "(':');");
         pigServer.registerQuery("b = load '"
-                + Util.generateURI(f2.toString(), pigServer.getPigContext())
+                + Util.generateURI(Util.encodeEscape(f2.toString()), pigServer.getPigContext())
                 + "';");
         pigServer.registerQuery("c = cogroup a by $0, b by $0;");        
         pigServer.registerQuery("d = foreach c generate flatten($1),flatten($2);");
@@ -151,7 +151,7 @@ public class TestEvalPipelineLocal {
         pw.println("a");
         pw.close();
         pigServer.registerQuery("a = foreach (load '"
-                + Util.generateURI(f.toString(), pigServer.getPigContext())
+                + Util.generateURI(Util.encodeEscape(f.toString()), pigServer.getPigContext())
                 + "') generate 1, flatten(" + MyBagFunction.class.getName()
                 + "(*));");
 //        pigServer.registerQuery("b = foreach a generate $0, flatten($1);");
@@ -185,13 +185,14 @@ public class TestEvalPipelineLocal {
         b.add(t);
         
         File tempF = File.createTempFile("tmp", "");
-        String fileName = tempF.getCanonicalPath();
         tempF.delete(); // we only needed the temp file name, so delete the file
+        String fileName = Util.removeColon(tempF.getCanonicalPath());
+
         PigFile f = new PigFile(fileName);
         f.store(b, new FuncSpec(BinStorage.class.getCanonicalName()), pigServer.getPigContext());
         
         
-        pigServer.registerQuery("a = load '" + fileName + "' using BinStorage();");
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(fileName) + "' using BinStorage();");
         pigServer.registerQuery("b = foreach a generate $0#'apple',flatten($1#'orange');");
         Iterator<Tuple> iter = pigServer.openIterator("b");
         t = iter.next();
@@ -339,11 +340,11 @@ public class TestEvalPipelineLocal {
         expectedResults.put("conference", 1);
         
         pigServer.registerQuery("newsArticles = LOAD '"
-                + Util.generateURI(newsFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(newsFile.toString()), pigServer
                         .getPigContext()) + "' USING "
                 + TextLoader.class.getName() + "();");
         pigServer.registerQuery("queryLog = LOAD '"
-                + Util.generateURI(queryLogFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(queryLogFile.toString()), pigServer
                         .getPigContext()) + "';");
 
         pigServer.registerQuery("titleNGrams = FOREACH newsArticles GENERATE flatten(" +
TitleNGrams.class.getName() + "(*));");
@@ -400,7 +401,7 @@ public class TestEvalPipelineLocal {
         
         String tmpOutputFile = FileLocalizer.getTemporaryPath(pigServer.getPigContext()).toString();
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         if (eliminateDuplicates){
             pigServer.registerQuery("B = DISTINCT (FOREACH A GENERATE $0) PARALLEL 10;");
@@ -413,7 +414,7 @@ public class TestEvalPipelineLocal {
         }
         pigServer.store("B", tmpOutputFile);
         
-        pigServer.registerQuery("A = load '" + tmpOutputFile + "';");
+        pigServer.registerQuery("A = load '" + Util.encodeEscape(tmpOutputFile) + "';");
         Iterator<Tuple> iter = pigServer.openIterator("A");
         String last = "";
         HashSet<Integer> seen = new HashSet<Integer>();
@@ -447,7 +448,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = group A by $0;");
         String query = "C = foreach B {"
@@ -487,7 +488,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = group A by $0;");
         String query = "C = foreach B {"
@@ -529,7 +530,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = limit A 5;");
         Iterator<Tuple> iter = pigServer.openIterator("B");
@@ -549,7 +550,7 @@ public class TestEvalPipelineLocal {
                 new String[] {"{(f1, f2),(f3, f4)}\t(1,2)\t[key1#value1,key2#value2]"});
         
         pigServer.registerQuery("a = load '"
-                + Util.generateURI(input.toString(), pigServer.getPigContext())
+                + Util.generateURI(Util.encodeEscape(input.toString()), pigServer.getPigContext())
                 + "' using PigStorage() "
                 + "as (b:bag{t:tuple(x,y)}, t2:tuple(a,b), m:map[]);");
         pigServer.registerQuery("b = foreach a generate COUNT(b), t2.a, t2.b, m#'key1', m#'key2';");
@@ -563,7 +564,7 @@ public class TestEvalPipelineLocal {
         
         //test with BinStorage
         pigServer.registerQuery("a = load '"
-                + Util.generateURI(input.toString(), pigServer.getPigContext())
+                + Util.generateURI(Util.encodeEscape(input.toString()), pigServer.getPigContext())
                 + "' using PigStorage() "
                 + "as (b:bag{t:tuple(x,y)}, t2:tuple(a,b), m:map[]);");
         String output = "./TestEvalPipeline-testComplexData";
@@ -590,7 +591,7 @@ public class TestEvalPipelineLocal {
         File input = Util.createInputFile("tmp", "", 
                 new String[] {"{(f1, f2),(f3, f4)}\t(1,2)\t[key1#value1,key2#value2]"});
         
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +
"' using PigStorage() " +
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) + "' using
PigStorage() " +
                 "as (b:bag{t:tuple(x:chararray,y:chararray)}, t2:tuple(a:int,b:int), m:map[]);");
         pigServer.registerQuery("b = foreach a generate COUNT(b), t2.a, t2.b, m#'key1', m#'key2';");
         Iterator<Tuple> it = pigServer.openIterator("b");
@@ -602,7 +603,7 @@ public class TestEvalPipelineLocal {
         Assert.assertEquals("value2", t.get(4).toString());
         
         //test with BinStorage
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +
"' using PigStorage() " +
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) + "' using
PigStorage() " +
                 "as (b:bag{t:tuple(x:chararray,y:chararray)}, t2:tuple(a:int,b:int), m:map[]);");
         String output = "./TestEvalPipeline-testBinStorageDetermineSchema";
         pigServer.deleteFile(output);
@@ -647,7 +648,7 @@ public class TestEvalPipelineLocal {
         // projected all columns apear in the output
         File input = Util.createInputFile("tmp", "", 
                 new String[] {"f1\tf2\tf3"});
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +
"' as (x, y, z);");
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) + "' as
(x, y, z);");
         pigServer.registerQuery("b = group a by x;");
         pigServer.registerQuery("c = foreach b generate flatten(a.(y, z));");
         Iterator<Tuple> it = pigServer.openIterator("c");
@@ -663,7 +664,7 @@ public class TestEvalPipelineLocal {
         File input = Util.createInputFile("tmp", "", 
                 new String[] {"pigtester\t10\t1.2"});
         
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +
"' using PigStorage() " +
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) + "' using
PigStorage() " +
                 "as (name:chararray, age:int, gpa:double);");
         String output = "./TestEvalPipeline-testBinStorageDetermineSchema2";
         pigServer.deleteFile(output);
@@ -736,10 +737,10 @@ public class TestEvalPipelineLocal {
         resultMap.put("pigtester2", new Pair<Long, Long>(10L, 1L));
         resultMap.put("pigtester3", new Pair<Long, Long>(60L, 3L));
         
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +
"' using PigStorage() " +
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) + "' using
PigStorage() " +
                 "as (name:chararray, age:int, gpa:double);");
         pigServer.registerQuery("b = group a by name;");
-        pigServer.registerQuery("c = load 'file:" + Util.encodeEscape(input.toString()) +
"' using PigStorage() " +
+        pigServer.registerQuery("c = load '" + Util.encodeEscape(input.toString()) + "' using
PigStorage() " +
         "as (name:chararray, age:int, gpa:double);");
         pigServer.registerQuery("d = cogroup b by group, c by name;");
         pigServer.registerQuery("e = foreach d generate flatten(group), SUM(c.age), COUNT(c.name);");
@@ -759,7 +760,7 @@ public class TestEvalPipelineLocal {
         // Create input file with unicode data
         File input = Util.createInputFile("tmp", "", 
                 new String[] {"wendyξ"});
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +
"' using PigStorage() " +
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) + "' using
PigStorage() " +
         "as (name:chararray);");
         Iterator<Tuple> it = pigServer.openIterator("a");
         Tuple t = it.next();
@@ -780,7 +781,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = foreach A generate "
                 + MapUDF.class.getName() + "($0) as mymap;"); // the argument
@@ -824,7 +825,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = foreach A generate "
                 + MapUDF.class.getName() + "($0) as mymap;"); // the argument
@@ -848,7 +849,7 @@ public class TestEvalPipelineLocal {
         // Create input file
         File input = Util.createInputFile("tmp", "", 
                 new String[] {"hello:world"});
-        pigServer.registerQuery("a = load 'file:" + Util.encodeEscape(input.toString()) +

+        pigServer.registerQuery("a = load '" + Util.encodeEscape(input.toString()) +
                 "' using org.apache.pig.test.PigStorageNoDefCtor(':');");
         pigServer.registerQuery("b = foreach a generate (chararray)$0, (chararray)$1;");
         Iterator<Tuple> it = pigServer.openIterator("b");
@@ -872,7 +873,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = group A by $0;");
         String query = "C = foreach B {"
@@ -915,7 +916,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = distinct A;");
         String query = "C = foreach B {"
@@ -963,7 +964,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = distinct A;");
         String query = "C = foreach B {"
@@ -1005,7 +1006,7 @@ public class TestEvalPipelineLocal {
         ps.close();
 
         pigServer.registerQuery("A = LOAD '"
-                + Util.generateURI(tmpFile.toString(), pigServer
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pigServer
                         .getPigContext()) + "';");
         pigServer.registerQuery("B = distinct A ;"); //the argument does not matter
         pigServer.registerQuery("C = foreach B generate FLATTEN(" + Identity.class.getName()
+ "($0, $1));"); //the argument does not matter

Modified: pig/trunk/test/org/apache/pig/test/TestForEachNestedPlanLocal.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestForEachNestedPlanLocal.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestForEachNestedPlanLocal.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestForEachNestedPlanLocal.java Wed Oct 31 21:12:26
2012
@@ -49,7 +49,7 @@ public class TestForEachNestedPlanLocal 
             System.err.println("Running testInnerOrderBy with nullFlags set to :" + nullFlags[i]);
             File tmpFile = genDataSetFile1(nullFlags[i]);
             pig.registerQuery("a = load '"
-                    + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                    + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                     + "'; ");
             pig.registerQuery("b = group a by $0; ");
             pig.registerQuery("c = foreach b { " + "     c1 = order $1 by *; "
@@ -70,7 +70,7 @@ public class TestForEachNestedPlanLocal 
     public void testInnerLimit() throws Exception {
         File tmpFile = genDataSetFileOneGroup();
         pig.registerQuery("a = load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("b = group a by $0; ");
         pig.registerQuery("c = foreach b { " + "     c1 = limit $1 5; "

Modified: pig/trunk/test/org/apache/pig/test/TestLOLoadDeterminedSchema.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestLOLoadDeterminedSchema.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestLOLoadDeterminedSchema.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestLOLoadDeterminedSchema.java Wed Oct 31 21:12:26
2012
@@ -70,7 +70,7 @@ public class TestLOLoadDeterminedSchema 
 		server.registerFunction(ScriptSchemaTestLoader.class.getName(),
 				funcSpec);
 
-		server.registerQuery("a = LOAD '" + inputFile.getAbsolutePath()
+		server.registerQuery("a = LOAD '" + Util.encodeEscape(inputFile.getAbsolutePath())
 				+ "' using " + ScriptSchemaTestLoader.class.getName()
 				+ "() as (a, b, c) ;");
 

Modified: pig/trunk/test/org/apache/pig/test/TestLocal.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestLocal.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestLocal.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestLocal.java Wed Oct 31 21:12:26 2012
@@ -102,7 +102,7 @@ public class TestLocal extends TestCase 
     public Double bigGroupAll( File tmpFile ) throws Throwable {
 
         String query = "foreach (group (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "') all) generate " + COUNT.class.getName() + "($1) ;";
         System.out.println(query);
         pig.registerQuery("asdf_id = " + query);
@@ -198,7 +198,7 @@ public class TestLocal extends TestCase 
 
     //Load, Execute and Store query
         String query = "foreach (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "') generate $0,$1;";
         System.out.println(query);
         pig.registerQuery("asdf_id = " + query);
@@ -249,7 +249,7 @@ public class TestLocal extends TestCase 
 
     // Load, Execute and Store query
         String query = "foreach (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "') generate $0,$1;";
         System.out.println(query);
         pig.registerQuery("asdf_id = " + query);
@@ -294,7 +294,7 @@ public class TestLocal extends TestCase 
 
         // execute query
         String query = "foreach (group (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "' using " + MyStorage.class.getName() + "()) by "
                 + MyGroup.class.getName() + "('all')) generate flatten("
                 + MyApply.class.getName() + "($1)) ;";
@@ -333,7 +333,7 @@ public class TestLocal extends TestCase 
 
         // execute query
         String query = "foreach (group (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "' using " + MyStorage.class.getName() + "()) by "
                 + MyGroup.class.getName() + "('all')) generate flatten("
                 + MyApply.class.getName() + "($1)) ;";
@@ -368,7 +368,7 @@ public class TestLocal extends TestCase 
         pig.registerFunction("foo",
             new FuncSpec(MyApply.class.getName()+"('foo')"));
         String query = "foreach (group (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "' using " + MyStorage.class.getName() + "()) by "
                 + MyGroup.class.getName()
                 + "('all')) generate flatten(foo($1)) ;";
@@ -417,7 +417,7 @@ public class TestLocal extends TestCase 
         pig.registerFunction("foo",
             new FuncSpec(MyApply.class.getName()+"('foo')"));
         String query = "foreach (group (load '"
-                + Util.generateURI(tmpFile.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile.toString()), pig.getPigContext())
                 + "' using " + MyStorage.class.getName() + "()) by "
                 + MyGroup.class.getName()
                 + "('all')) generate flatten(foo($1)) ;";

Modified: pig/trunk/test/org/apache/pig/test/TestLocal2.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestLocal2.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestLocal2.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestLocal2.java Wed Oct 31 21:12:26 2012
@@ -52,10 +52,10 @@ public class TestLocal2 extends TestCase
         File tmpFile1 = genDataSetFile(false, 30 ) ;
         File tmpFile2 = genDataSetFile(false, 50 ) ;
         pig.registerQuery("a = load '"
-                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile1.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("b = load '"
-                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile2.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("c = union a, b; ") ;
         
@@ -68,10 +68,10 @@ public class TestLocal2 extends TestCase
         File tmpFile1 = genDataSetFile(true, 30 ) ;
         File tmpFile2 = genDataSetFile(true, 50 ) ;
         pig.registerQuery("a = load '"
-                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile1.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("b = load '"
-                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile2.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("c = union a, b; ") ;
 
@@ -84,10 +84,10 @@ public class TestLocal2 extends TestCase
         File tmpFile1 = genDataSetFile(false, 30) ;
         File tmpFile2 = genDataSetFile(false, 50) ;
         pig.registerQuery("a = load '"
-                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile1.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("b = load '"
-                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile2.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("a1 = foreach a generate $0, $1; ") ;
         pig.registerQuery("b1 = foreach b generate $0, $1; ") ;
@@ -101,10 +101,10 @@ public class TestLocal2 extends TestCase
         File tmpFile1 = genDataSetFile(true, 30) ;
         File tmpFile2 = genDataSetFile(true, 50) ;
         pig.registerQuery("a = load '"
-                + Util.generateURI(tmpFile1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile1.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("b = load '"
-                + Util.generateURI(tmpFile2.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(tmpFile2.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("a1 = foreach a generate $0, $1; ") ;
         pig.registerQuery("b1 = foreach b generate $0, $1; ") ;
@@ -123,7 +123,7 @@ public class TestLocal2 extends TestCase
         ps.close();
         
         pig.registerQuery("A = load '"
-                + Util.generateURI(fp1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(fp1.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("B = foreach A generate flatten("
                 + Pig800Udf.class.getName() + "($0));");
@@ -146,7 +146,7 @@ public class TestLocal2 extends TestCase
         ps.close();
         
         pig.registerQuery("A = load '"
-                + Util.generateURI(fp1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(fp1.toString()), pig.getPigContext())
                 + "'; ");
         pig.registerQuery("B = foreach A generate flatten("
                 + Pig800Udf.class.getName() + "($0));");
@@ -169,7 +169,7 @@ public class TestLocal2 extends TestCase
         ps.close();
         
         pig.registerQuery("A = load '"
-                + Util.generateURI(fp1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(fp1.toString()), pig.getPigContext())
                 + "' AS (c1:int, c2:int); ");
         pig.registerQuery("B = filter A by c1 > 0;");
         pig.registerQuery("C = filter B by c1 < 2;");
@@ -205,10 +205,10 @@ public class TestLocal2 extends TestCase
         
         
         pig.registerQuery("A = load '"
-                + Util.generateURI(fp1.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(fp1.toString()), pig.getPigContext())
                 + "'AS (a0:int, a1:int); ");
         pig.registerQuery("B = load '"
-                + Util.generateURI(fp2.toString(), pig.getPigContext())
+                + Util.generateURI(Util.encodeEscape(fp2.toString()), pig.getPigContext())
                 + "'AS (b0:int, b1:int); ");
         pig.registerQuery("C = join A by a0, B by b0;");
         

Modified: pig/trunk/test/org/apache/pig/test/TestSplitIndex.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/test/TestSplitIndex.java?rev=1404353&r1=1404352&r2=1404353&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/test/TestSplitIndex.java (original)
+++ pig/trunk/test/org/apache/pig/test/TestSplitIndex.java Wed Oct 31 21:12:26 2012
@@ -53,7 +53,7 @@ public class TestSplitIndex {
     
     @Test
     public void testSplitIndex() throws Exception {
-        pigServer.registerQuery("a = load '" + inputDir + "' using " + SplitSensitiveLoadFunc.class.getName()
+ "();");
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(inputDir.toString()) + "'
using " + SplitSensitiveLoadFunc.class.getName() + "();");
         Iterator<Tuple> iter = pigServer.openIterator("a");
         
         boolean file1exist=false, file2exist=false;
@@ -74,7 +74,7 @@ public class TestSplitIndex {
     @Test
     public void testSplitIndexNoCombine() throws Exception {
         pigServer.getPigContext().getProperties().setProperty("pig.splitCombination", "false");
-        pigServer.registerQuery("a = load '" + inputDir + "' using " + SplitSensitiveLoadFunc.class.getName()
+ "();");
+        pigServer.registerQuery("a = load '" + Util.encodeEscape(inputDir.toString()) + "'
using " + SplitSensitiveLoadFunc.class.getName() + "();");
         Iterator<Tuple> iter = pigServer.openIterator("a");
         
         boolean file1exist=false, file2exist=false;



Mime
View raw message