You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by da...@apache.org on 2015/11/02 21:10:07 UTC
svn commit: r1712139 - in /pig/branches/branch-0.15: CHANGES.txt
src/org/apache/pig/impl/streaming/PigStreamingUDF.java
test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java
Author: daijy
Date: Mon Nov 2 20:10:06 2015
New Revision: 1712139
URL: http://svn.apache.org/viewvc?rev=1712139&view=rev
Log:
PIG-4696: Empty map returned by a streaming_python udf wrongly contains a null key
Modified:
pig/branches/branch-0.15/CHANGES.txt
pig/branches/branch-0.15/src/org/apache/pig/impl/streaming/PigStreamingUDF.java
pig/branches/branch-0.15/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java
Modified: pig/branches/branch-0.15/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.15/CHANGES.txt?rev=1712139&r1=1712138&r2=1712139&view=diff
==============================================================================
--- pig/branches/branch-0.15/CHANGES.txt (original)
+++ pig/branches/branch-0.15/CHANGES.txt Mon Nov 2 20:10:06 2015
@@ -28,6 +28,8 @@ OPTIMIZATIONS
BUG FIXES
+PIG-4696: Empty map returned by a streaming_python udf wrongly contains a null key (cheolsoo)
+
PIG-4712: [Pig on Tez] NPE in Bloom UDF after Union (rohini)
PIG-4707: [Pig on Tez] Streaming job hangs with pig.exec.mapPartAgg=true (rohini)
Modified: pig/branches/branch-0.15/src/org/apache/pig/impl/streaming/PigStreamingUDF.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.15/src/org/apache/pig/impl/streaming/PigStreamingUDF.java?rev=1712139&r1=1712138&r2=1712139&view=diff
==============================================================================
--- pig/branches/branch-0.15/src/org/apache/pig/impl/streaming/PigStreamingUDF.java (original)
+++ pig/branches/branch-0.15/src/org/apache/pig/impl/streaming/PigStreamingUDF.java Mon Nov 2 20:10:06 2015
@@ -202,7 +202,7 @@ public class PigStreamingUDF extends Pig
if (StreamingDelimiters.isDelimiter(DELIMS.getFieldDelim(), buf, index, depth, endIndex)) {
val = extractString(buf, fieldStart, index - 1, true);
- map.put(key, val);
+ if (key != null) map.put(key, val);
fieldStart = index + 3;
}
}
Modified: pig/branches/branch-0.15/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.15/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java?rev=1712139&r1=1712138&r2=1712139&view=diff
==============================================================================
--- pig/branches/branch-0.15/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java (original)
+++ pig/branches/branch-0.15/test/org/apache/pig/impl/streaming/TestPigStreamingUDF.java Mon Nov 2 20:10:06 2015
@@ -369,6 +369,18 @@ public class TestPigStreamingUDF {
}
@Test
+ public void testDeserialize__emptyMap() throws IOException {
+ byte[] input = "|[_|]_|_".getBytes();
+ FieldSchema fs = new FieldSchema("", DataType.MAP);
+ PigStreamingUDF sp = new PigStreamingUDF(fs);
+
+ Map<String, String> expectedOutput = new TreeMap<String, String>();
+
+ Object out = sp.deserialize(input, 0, input.length);
+ Assert.assertEquals(tf.newTuple(expectedOutput), out);
+ }
+
+ @Test
public void testDeserialize__bug() throws Exception {
byte[] input = "|(_|-_|,_32|,_987654321098765432|,_987654321098765432|)_|_".getBytes();