Author: daijy
Date: Wed May 13 02:23:30 2009
New Revision: 774167

URL: http://svn.apache.org/viewvc?rev=774167&view=rev
Log:
PIG-799: Unit tests on windows are failing after multiquery commit

Modified:
    hadoop/pig/trunk/CHANGES.txt
    hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
    hadoop/pig/trunk/test/org/apache/pig/test/TestCounters.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestLoad.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestTypeChecking.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=774167&r1=774166&r2=774167&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Wed May 13 02:23:30 2009
@@ -70,6 +70,8 @@
 
 PIG-806: to remove author tags in the pig source code (sms).
 
+PIG-799: Unit tests on windows are failing after multiquery commit (daijy)
+
 Release 0.2.0
 
 INCOMPATIBLE CHANGES

Modified: 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt?rev=774167&r1=774166&r2=774167&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt 
(original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/impl/logicalLayer/parser/QueryParser.jjt 
Wed May 13 02:23:30 2009
@@ -175,18 +175,14 @@
        
 
     String massageFilename(String filename, PigContext pigContext, boolean 
isLoad) throws IOException, ParseException {
-        boolean isMultiQuery = 
"true".equalsIgnoreCase(pigContext.getProperties().getProperty("opt.multiquery","true"));
-
+        if (filename.startsWith(FileLocalizer.LOCAL_PREFIX)&&isLoad) {
+            filename = FileLocalizer.hadoopify(filename, pigContext);
+        } 
+       boolean isMultiQuery = 
"true".equalsIgnoreCase(pigContext.getProperties().getProperty("opt.multiquery","true"));
         if (!isMultiQuery) {
             if(!isLoad) {
                 return filename;
             }
-
-            if (pigContext.getExecType() != ExecType.LOCAL) {
-                if (filename.startsWith(FileLocalizer.LOCAL_PREFIX)) {
-                    filename = FileLocalizer.hadoopify(filename, pigContext);
-                } 
-            }
             return filename;
         }
 

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestCounters.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestCounters.java?rev=774167&r1=774166&r2=774167&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestCounters.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestCounters.java Wed May 13 
02:23:30 2009
@@ -540,7 +540,7 @@
         File out = File.createTempFile("output", ".txt");
         out.delete();
         PigServer pigServer = new PigServer("local");
-        pigServer.registerQuery("a = load '" + file + "';");
+        pigServer.registerQuery("a = load '" + 
Util.encodeEscape(file.toString()) + "';");
         pigServer.registerQuery("b = order a by $0;");
         pigServer.registerQuery("c = group b by $0;");
         pigServer.registerQuery("d = foreach c generate group, SUM(b.$1);");

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestLoad.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestLoad.java?rev=774167&r1=774166&r2=774167&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestLoad.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestLoad.java Wed May 13 02:23:30 
2009
@@ -70,6 +70,8 @@
     public void setUp() throws Exception {
         curDir = System.getProperty("user.dir");
         inpDir = curDir + File.separatorChar + 
"test/org/apache/pig/test/data/InputFiles/";
+        if 
((System.getProperty("os.name").toUpperCase().startsWith("WINDOWS")))
+            inpDir="/"+FileLocalizer.parseCygPath(inpDir, 
FileLocalizer.STYLE_WINDOWS);
         inpFSpec = new FileSpec("file:" + inpDir + "passwd", new 
FuncSpec(PigStorage.class.getName(), new String[]{":"}));
 
         FileLocalizer.deleteTempFiles();
@@ -117,7 +119,13 @@
 
     @Test
     public void testLoadLocalAbs() throws Exception {
-        checkLoadPath("file:"+curDir + 
File.separatorChar+"test/org/apache/pig/test/data/passwd", "", true);
+       String filename = curDir + 
File.separatorChar+"test/org/apache/pig/test/data/passwd";
+        if 
((System.getProperty("os.name").toUpperCase().startsWith("WINDOWS")))
+        {
+            filename="/"+FileLocalizer.parseCygPath(filename, 
FileLocalizer.STYLE_WINDOWS);
+            filename=Util.encodeEscape(filename);
+        }
+        checkLoadPath("file:"+filename, "", true);
     }
 
     @Test

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestTypeChecking.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestTypeChecking.java?rev=774167&r1=774166&r2=774167&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestTypeChecking.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestTypeChecking.java Wed May 13 
02:23:30 2009
@@ -252,7 +252,7 @@
 
     public void testSUM2() throws Throwable {
         TypeCheckingTestUtil.printCurrentMethodName() ;
-        planTester.buildPlan("a = group (load 'file:\" + tmpFile + \"') by 
($0,$1);") ;
+        planTester.buildPlan("a = group (load '\" + tmpFile + \"') by 
($0,$1);") ;
         LogicalPlan plan1 = planTester.buildPlan("b = foreach a generate 
flatten(group), SUM($1.$2);") ;
         planTester.typeCheckPlan(plan1);
     }


Reply via email to