Author: olga
Date: Fri Jan 16 16:30:30 2009
New Revision: 735189

URL: http://svn.apache.org/viewvc?rev=735189&view=rev
Log:
PIG-597: fix for how * is interpreted by UDFs

Modified:
    hadoop/pig/trunk/CHANGES.txt
    
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
    hadoop/pig/trunk/src/org/apache/pig/impl/builtin/FindQuantiles.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestBuiltin.java
    hadoop/pig/trunk/test/org/apache/pig/test/TestFRJoin.java

Modified: hadoop/pig/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/CHANGES.txt?rev=735189&r1=735188&r2=735189&view=diff
==============================================================================
--- hadoop/pig/trunk/CHANGES.txt (original)
+++ hadoop/pig/trunk/CHANGES.txt Fri Jan 16 16:30:30 2009
@@ -359,3 +359,5 @@
     PIG-570:  problems with handling bzip data (breed via olgan)
 
        PIG-599: Added buffering to BufferedPositionedInputStream (gates)
+
+    PIG-597: Fix for how * is treated by UDFs (shravanmn via olgan)

Modified: 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java?rev=735189&r1=735188&r2=735189&view=diff
==============================================================================
--- 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
 (original)
+++ 
hadoop/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/expressionOperators/POUserFunc.java
 Fri Jan 16 16:30:30 2009
@@ -159,7 +159,8 @@
                 if(temp.returnStatus!=POStatus.STATUS_OK)
                     return temp;
                 
-                if(op instanceof POProject &&
+                /* Refer Pig-597 */
+                /* if(op instanceof POProject &&
                         op.getResultType() == DataType.TUPLE){
                     POProject projOp = (POProject)op;
                     if(projOp.isStar()){
@@ -169,7 +170,7 @@
                             rslt.append(trslt.get(i));
                         continue;
                     }
-                }
+                }*/
                 ((Tuple)res.result).append(temp.result);
                        }
                        res.returnStatus = temp.returnStatus;

Modified: hadoop/pig/trunk/src/org/apache/pig/impl/builtin/FindQuantiles.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/impl/builtin/FindQuantiles.java?rev=735189&r1=735188&r2=735189&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/impl/builtin/FindQuantiles.java 
(original)
+++ hadoop/pig/trunk/src/org/apache/pig/impl/builtin/FindQuantiles.java Fri Jan 
16 16:30:30 2009
@@ -98,10 +98,14 @@
      */
     
     @Override
-    public DataBag exec(Tuple input) throws IOException {
+    public DataBag exec(Tuple in) throws IOException {
+        if(in==null || in.size()==0)
+            return null;
         Integer numQuantiles = null;
         DataBag samples = null;
+        
         try{
+            Tuple input = (Tuple) in.get(0);
             numQuantiles = (Integer)input.get(0);
             samples = (DataBag)input.get(1);
         }catch(ExecException e){

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestBuiltin.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestBuiltin.java?rev=735189&r1=735188&r2=735189&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestBuiltin.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestBuiltin.java Fri Jan 16 
16:30:30 2009
@@ -1031,7 +1031,7 @@
         // It is depricated but we still need to make sure it works
         ARITY arrity = new ARITY();
         msg = "[Testing ARRITY on input type: Tuple]";
-        //assertTrue(msg, expected.equals(arrity.exec(t5)));
+        assertTrue(msg, expected.equals(new Long(arrity.exec(t5))));
     }
 
     // Builtin APPLY Functions

Modified: hadoop/pig/trunk/test/org/apache/pig/test/TestFRJoin.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/test/org/apache/pig/test/TestFRJoin.java?rev=735189&r1=735188&r2=735189&view=diff
==============================================================================
--- hadoop/pig/trunk/test/org/apache/pig/test/TestFRJoin.java (original)
+++ hadoop/pig/trunk/test/org/apache/pig/test/TestFRJoin.java Fri Jan 16 
16:30:30 2009
@@ -98,12 +98,13 @@
         }
 
         @Override
-        public DataBag exec(Tuple input) throws IOException {
+        public DataBag exec(Tuple in) throws IOException {
             if(!isTblSetUp){
                 setUpHashTable();
                 isTblSetUp = true;
             }
             try {
+                Tuple input = (Tuple)in.get(0);
                 String key = (String) input.get(keyField);
                 if(!replTbl.containsKey(key)) return 
BagFactory.getInstance().newDefaultBag();
                 return replTbl.get(key);


Reply via email to