pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Coveney (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIG-2724) Make Tuple Iterable
Date Wed, 30 May 2012 23:19:23 GMT

    [ https://issues.apache.org/jira/browse/PIG-2724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286183#comment-13286183
] 

Jonathan Coveney commented on PIG-2724:
---------------------------------------

- Thanks for the heads up on the javadoc
- Yeah, I was thinking about pushing in hashCode as well, but I don't like the idea of pushing
in hashCode if we don't push in compareTo as well... either we have default behavior for both,
or neither, IMHO.
- I will have DefaultTuple override it and do what it used to do, and leave AbstractTuple's
as the general.
- AbstractTypeAwareTuple let's you merge together AbstractTuple+TypeAwareTuple interface.
It feels cleaner than forcing classes to do that themselves?
                
> Make Tuple Iterable
> -------------------
>
>                 Key: PIG-2724
>                 URL: https://issues.apache.org/jira/browse/PIG-2724
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Jonathan Coveney
>            Assignee: Jonathan Coveney
>             Fix For: 0.11
>
>         Attachments: PIG-2724-0.patch, PIG-2724-1.patch, PIG-2724-1.patch
>
>
> Seriously, is there a more annoying pattern than the following?
> {code}
> for (int i = 0; i < t.size(); i++) {
>     try {
>         doStuff(t.get(i));
>     } catch (ExecException e) {
>         throw new RuntimeException("BUT I THOUGHT PIG WAS SINGLETHREADED", e);
>     }
> }
> {code}
> I mean yeah, you can do the following:
> {code}
> for (Object o : t.getAll()) {
>     doStuff(o);
> }
> {code}
> But I don't even think that should be necessary. I think the following should work:
> {code}
> for (Object o : t) {
>     doStuff(o);
> }
> {code}
> It's a shame we can't give a default implementation (I either shake my fist that this
won't be possible until Java 8 OR that Tuple is an interface and not an abstract class). Either
way, I even added test! WOAH.
> Thoughts?

--
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

        

Mime
View raw message