Author: daijy
Date: Fri May 21 18:09:23 2010
New Revision: 947105

URL: http://svn.apache.org/viewvc?rev=947105&view=rev
Log:
PIG-1420: Make CONCAT act on all fields of a tuple, instead of just the first 
two fields of a tuple (fix NPE)

Modified:
    hadoop/pig/trunk/src/org/apache/pig/builtin/CONCAT.java
    hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/CONCAT.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/CONCAT.java?rev=947105&r1=947104&r2=947105&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/CONCAT.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/CONCAT.java Fri May 21 18:09:23 
2010
@@ -45,6 +45,8 @@ public class CONCAT extends EvalFunc<Dat
 
             DataByteArray db = new DataByteArray();
             for (int i = 0; i < input.size(); i++) {
+                if (input.get(i)==null)
+                    return null;
                 db.append((DataByteArray)(input.get(i)));
             }
             return db;

Modified: hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java?rev=947105&r1=947104&r2=947105&view=diff
==============================================================================
--- hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java (original)
+++ hadoop/pig/trunk/src/org/apache/pig/builtin/StringConcat.java Fri May 21 
18:09:23 2010
@@ -39,7 +39,9 @@ public class StringConcat extends EvalFu
 
           StringBuilder sb = new StringBuilder();
           for (int i = 0; i < input.size(); i++){
-            sb.append(String.valueOf(input.get(i)));
+              if (input.get(i)==null)
+                  return null;
+              sb.append(String.valueOf(input.get(i)));
           }
           return sb.toString();
         } catch (ExecException exp) {


Reply via email to