You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Cheolsoo Park (JIRA)" <ji...@apache.org> on 2013/03/05 20:28:12 UTC

[jira] [Created] (PIG-3234) Remove anti-pattern in LoadFunc implementations

Cheolsoo Park created PIG-3234:
----------------------------------

             Summary: Remove anti-pattern in LoadFunc implementations
                 Key: PIG-3234
                 URL: https://issues.apache.org/jira/browse/PIG-3234
             Project: Pig
          Issue Type: Improvement
            Reporter: Cheolsoo Park


I noticed this anti-pattern while reviewing PIG-3142. A lot of LoadFunc implementations in our code base does the following:
{code}
public Tuple getNext() throws IOException {
    if (!initialized) {
        // initialize
        initialized = true;
    }
    // load data
}
{code}
The LoadFunc interface provides prepareToRead() for any kind of initialization during execution, so we should use it instead. Looking at the commit history, this anti-pattern wasn't cleaned up when the load/store func redesign was merged to trunk:
http://svn.apache.org/viewvc?limit_changes=0&view=revision&revision=911959

To prevent this anti-pattern from being copied and pasted by new LoadFunc implementations, it would be nice if we could get rid of them in our code base.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira