[ https://issues.apache.org/jira/browse/PIG-1841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Laukik Chitnis updated PIG-1841: -------------------------------- Attachment: PIG-1841.patch The TupleSize.exec(Tuple input) method needed to unwrap the actual Tuple whose size is to be determined from the input Tuple. Fixed the unit tests which were assuming that there would be no wrapping of the object of interest. Also added a new end-to-end test case. Results from the test-patch run: {noformat} [exec] [exec] +1 overall. [exec] [exec] +1 @author. The patch does not contain any @author tags. [exec] [exec] +1 tests included. The patch appears to include 3 new or modified tests. [exec] [exec] +1 javadoc. The javadoc tool did not generate any warning messages. [exec] [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings. [exec] [exec] +1 findbugs. The patch does not introduce any new Findbugs warnings. [exec] [exec] +1 release audit. The applied patch does not increase the total number of release audit warnings. [exec] {noformat} > TupleSize implemented incorrectly > --------------------------------- > > Key: PIG-1841 > URL: https://issues.apache.org/jira/browse/PIG-1841 > Project: Pig > Issue Type: Bug > Affects Versions: 0.8.0 > Reporter: Eric Tschetter > Assignee: Laukik Chitnis > Fix For: 0.8.0, 0.9.0 > > Attachments: PIG-1841.patch > > > I sent this to the list: > I'm looking at Pig's TupleSize implementation and wondering if it's > implemented correctly: > @Override > public Long exec(Tuple input) throws IOException { > try{ > if (input == null) return null; > return Long.valueOf(input.size()); > }catch(Exception e){ > int errCode = 2106; > String msg = "Error while computing size in " + > this.getClass().getSimpleName(); > throw new ExecException(msg, errCode, PigException.BUG, > e); > } > } > I have a script that looks like > A = FOREACH A GENERATE STRSPLIT(value, '\u0001') AS values; > B = FOREACH B GENERATE values, SIZE(values) AS cnt; > and cnt always ends up as 1. From the code, it looks like TupleSize > is intended to only return the number of arguments into the SIZE() > UDF? Is that really the intention and I'm using the SIZE() UDF wrong? > Or, is it just a bug and it's supposed to be written as "return > Long.valueOf(((Tuple) input.get(0)).size()))"? > I got this response back: > This is definitely a bug. Can you open a Jira ticket? > Done! -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira