crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabriel Reid (JIRA)" <>
Subject [jira] [Commented] (CRUNCH-157) Mark the setContext function in the DoFn class as final
Date Sun, 03 Feb 2013 15:28:12 GMT


Gabriel Reid commented on CRUNCH-157:

What do you think of making setContext and initialize totally independent of each other (and
don't make setContext final) ?

This would mean that we don't make setContext final, so that decorator DoFns can just send
the setContext call through to their underlying methods, as well as with initialize. We would
also have to make an explicit call to DoFn#initialize in RTNode#initialize.

It feels to me that doing it that way would just make things a lot more simple -- if you write
a wrapper DoFn, you just have to delegate all calls to the wrapped DoFn without thinking about
it, and other than that you just don't worry about the logic between initialize and setContext.
> Mark the setContext function in the DoFn class as final
> -------------------------------------------------------
>                 Key: CRUNCH-157
>                 URL:
>             Project: Crunch
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 0.3.0, 0.4.0
>            Reporter: Josh Wills
>            Assignee: Josh Wills
>         Attachments: CRUNCH-157.patch
> We often use a pattern of nested DoFns-- DoFns that are composed of operations on other
DoFns. There is currently an ambiguity around the right way to initialize those DoFns, since
it can be done either via overriding the initialize() or the setContext() methods in DoFn.
We should mark setContext as final in order to remove the ambiguity and fix the instances
in Crunch core where we override setContext() instead of initialize().

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:

View raw message