[
https://issues.apache.org/jira/browse/PIG-3000?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15258233#comment-15258233
]
Chon Ju Kim commented on PIG-3000:
----------------------------------
I encountered this issue with a little bit different code in our project. Here
is a code snippet.
{code} B = FOREACH A {
a = foo();
b = SUM(a.x);
GENERATE a, b, (t is null ? c : d);
} {code}
foo is called twice. Note that t is defined outside of the foreach.
> Optimize nested foreach
> -----------------------
>
> Key: PIG-3000
> URL: https://issues.apache.org/jira/browse/PIG-3000
> Project: Pig
> Issue Type: Bug
> Components: impl
> Affects Versions: 0.10.0
> Reporter: Richard Ding
> Assignee: Mona Chitnis
> Attachments: PIG-3000-6.patch, unit_tests.patch
>
>
> In this Pig script:
> {code}
> A = load 'data' as (a:chararray);
> B = foreach A { c = UPPER(a); generate ((c eq 'TEST') ? 1 : 0), ((c eq 'DEV')
> ? 1 : 0); }
> {code}
> The Eval function UPPER is called twice for each record.
> This should be optimized so that the UPPER is called only once for each record
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)