You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Daniel Dai (JIRA)" <ji...@apache.org> on 2013/10/04 23:37:42 UTC

[jira] [Reopened] (PIG-3434) Null subexpression in bincond nullifies outer tuple (or bag)

     [ https://issues.apache.org/jira/browse/PIG-3434?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dai reopened PIG-3434:
-----------------------------


Need to rollback this patch. The following script generate unexpected results:
in = load 'in';
out = FOREACH in GENERATE ROUND(($0 > 0 ? 2 : 3));
dump out;

out:
(3)
(())
(2)

The second line should be ().

The problem is:
1. Another fix in POUserFunc:
-            res.returnStatus = temp.returnStatus;
+            res.returnStatus = POStatus.STATUS_OK;
The status of the UDF input should be STATUS_OK instead of the status of the last input.

2. All UDF should be able to handle null input. Even with above mentioned change, the script file with NPE: FloatRound.java:47
FloatRound is not able to deal with null inputs. Adding null check for all UDF might be too much for 0.12.0. 

> Null subexpression in bincond nullifies outer tuple (or bag)
> ------------------------------------------------------------
>
>                 Key: PIG-3434
>                 URL: https://issues.apache.org/jira/browse/PIG-3434
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.11
>            Reporter: Pavel Fedyakov
>            Assignee: Mark Wagner
>             Fix For: 0.13.0
>
>         Attachments: PIG-3434.1.patch
>
>
> According to docs, for bincond operator "If a Boolean subexpression results in null value, the resulting expression is null" (http://pig.apache.org/docs/r0.11.0/basic.html#nulls).
> It works as described in plain foreach..generate expression:
> {noformat}
> in = load 'in';
> out = FOREACH in GENERATE 1, ($0 > 0 ? 2 : 3);
> dump out;
> {noformat}
> in (3 lines, 2nd is empty):
> {noformat}
> 0
> 1
> {noformat}
> out:
> {noformat}
> (1,3)
> (1,)
> (1,2)
> {noformat}
> But if we wrap generated variables in tuple (or bag), we lose the whole 2nd line in output:
> {noformat}
> out = FOREACH in GENERATE (1, ($0 > 0 ? 2 : 3));
> {noformat}
> out:
> {noformat}
> ((1,3))
> ()
> ((1,2))
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1#6144)