pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r951511 - in /hadoop/pig/trunk: CHANGES.txt src/org/apache/pig/tools/grunt/GruntParser.java test/org/apache/pig/test/TestGrunt.java
Date Fri, 04 Jun 2010 17:56:18 GMT
Author: hashutosh
Date: Fri Jun  4 17:56:18 2010
New Revision: 951511

URL: http://svn.apache.org/viewvc?rev=951511&view=rev
Log:
PIG-283: Allow to set arbitrary jobconf key-value pairs inside pig program

Modified:
    hadoop/pig/trunk/CHANGES.txt
    hadoop/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestGrunt.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=951511&r1=951510&r2=951511&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Fri Jun  4 17:56:18 2010
@@ -24,6 +24,8 @@ INCOMPATIBLE CHANGES
 
 IMPROVEMENTS
 
+PIG-283: Allow to set arbitrary jobconf key-value pairs inside pig program (hashutosh)
+
 PIG-1373: We need to add jdiff output to docs on the website (daijy)
 
 PIG-1422: Duplicate code in LOPrinter.java (zjffdu)

Modified: hadoop/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java?rev=951511&r1=951510&r2=951511&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/tools/grunt/GruntParser.java Fri Jun  4 17:56:18 2010
@@ -500,10 +500,7 @@ public class GruntParser extends PigScri
         }
         else
         {
-            // other key-value pairs can go there
-            // for now just throw exception since we don't support
-            // anything else
-            throw new ParseException("Unrecognized set key: " + key);
+        	mPigServer.getPigContext().getProperties().setProperty(key, value);
         }
     }
     

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestGrunt.java
URL: http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestGrunt.java?rev=951511&r1=951510&r2=951511&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestGrunt.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestGrunt.java Fri Jun  4 17:56:18 2010
@@ -1068,5 +1068,14 @@ public class TestGrunt extends TestCase 
         }
     }
     
-    
+    @Test
+    public void testSet() throws Throwable {
+
+    	String strCmd = "set my.arbitrary.key my.arbitrary.value\n";
+    	PigContext pc = new PigServer(ExecType.MAPREDUCE, cluster.getProperties()).getPigContext();
+    	InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(strCmd.getBytes()));
+        new Grunt(new BufferedReader(reader), pc).exec();
+        
+        assertEquals("my.arbitrary.value",  pc.getExecutionEngine().getConfiguration().getProperty("my.arbitrary.key"));
+    }
 }



Mime
View raw message