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

Gabriel Reid commented on CRUNCH-142:
-------------------------------------

I can imagine a situation where one of AndFn's delegate FilterFn's is making 
use of an external resource that was connected to in initialize, and so it 
should be released in cleanup (regardless of whether or not this is a good idea 
in a MapReduce context). With this in mind, it makes sense to delegate the 
cleanup call.

On the other hand, a FilterFn that is outputting stuff in the cleanup method is 
definitely breaking the FilterFn contract.

The safest thing that I can see that could be done while maintaining 
compatibility is to make FilterFn#cleanup(Emitter) final, with it calling a 
FilterFn-specific cleanup method that doesn't take any parameters. However, 
this seems like a lot of messing around for something that shouldn't happen 
anyhow, so I'm still leaning towards Dave's solution.
                
> Context not being passed to FilterFn instances wrapped in boolean 
> AndFn,OrFn,NotFn
> ----------------------------------------------------------------------------------
>
>                 Key: CRUNCH-142
>                 URL: https://issues.apache.org/jira/browse/CRUNCH-142
>             Project: Crunch
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.4.0
>            Reporter: Dave Beech
>            Assignee: Gabriel Reid
>             Fix For: 0.5.0
>
>         Attachments: CRUNCH-142_1.patch, CRUNCH-142_2.patch, CRUNCH-142.patch
>
>
> The boolean filter classes AndFn, OrFn and NotFn delegate calls to FilterFn 
> instances internally, but setContext is not called on these first. 
> As a result, methods which need the context such as getCounter() fail with 
> NullPointerException. 

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

Reply via email to