FLATTEN of null tuples produces unexpected number of fields
-----------------------------------------------------------
Key: PIG-2420
URL: https://issues.apache.org/jira/browse/PIG-2420
Project: Pig
Issue Type: Bug
Affects Versions: 0.9.0, 0.8.1, 0.8.0, 0.9.1, 0.10, 0.9.2
Reporter: Dmitriy V. Ryaboy
Flattening a null tuple results in a single column (with the value null) being produced.
That leads to all the columns after the flattened value shifting left by n-1 positions, where
n is the number of expected fields in a tuple!
Consider:
grunt> sh cat tmp/x
foo bar
a (b,c) d
grunt> x = load 'tmp/x' as (a:chararray, b:(b:chararray, c:chararray), d:chararray);
grunt> projected = foreach x generate d;
grunt> dump projected
(bar)
(d)
grunt> flattened = foreach x generate a, flatten(b) as (b, c), d;
grunt> dump flattened
(foo,,bar) -- NOTE THREE FIELDS INSTEAD OF EXPECTED 4
(a,b,c,d)
grunt> projected = foreach flattened generate d;
grunt> dump projected
() -- NOTE WRONG VALUE
(d)
grunt> projected = foreach flattened generate c;
() -- NOTE THAT, INCONSISTENTLY, C is NULL! AS IS B.
(c)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
|