[ 
https://issues.apache.org/jira/browse/BEAM-3979?focusedWorklogId=94315&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-94315
 ]

ASF GitHub Bot logged work on BEAM-3979:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 23/Apr/18 21:40
            Start Date: 23/Apr/18 21:40
    Worklog Time Spent: 10m 
      Work Description: reuvenlax commented on a change in pull request #4989: 
[BEAM-3979] Start completing the new DoFn vision: plumb context parameters into 
process functions.
URL: https://github.com/apache/beam/pull/4989#discussion_r183546264
 
 

 ##########
 File path: 
examples/java/src/main/java/org/apache/beam/examples/WindowedWordCount.java
 ##########
 @@ -106,7 +106,7 @@
     }
 
     @ProcessElement
-    public void processElement(ProcessContext c) {
+    public void processElement(@Element String element, OutputReceiver<String> 
receiver) {
 
 Review comment:
   <!--thread_id:cc_183500920_t; 
commit:e7163d592d424a480ae9071c770022129d401905; resolved:0-->
   <!--section:context-quote-->
   > **jkff** wrote:
   > OK so my main comment was that: the element parameter is nearly always 
present and always the most important parameter, so maybe we can elide the 
annotation for it, and say that it is by convention always the first parameter?
   > 
   > I saw one or two tests where the element parameter was missing, but I 
don't think that's common in production code, and it's easy to add an ignored 
parameter in those cases.
   
   <!--section:body-->
   I considered this initially, but I think this will be more error prone. 
Imagine cases where the element is an Instant and there is an Instant timestamp 
as well. We can always later allow eliding the @Element annotation if there is 
no such conflict, but IMO it's premature to do this now (I am not a fan of 
using parameter order to the function to determine this though)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 94315)
    Time Spent: 1h 50m  (was: 1h 40m)

> New DoFn should allow injecting of all parameters in ProcessContext
> -------------------------------------------------------------------
>
>                 Key: BEAM-3979
>                 URL: https://issues.apache.org/jira/browse/BEAM-3979
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 2.4.0
>            Reporter: Reuven Lax
>            Assignee: Reuven Lax
>            Priority: Major
>             Fix For: 2.5.0
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> This was intended in the past, but never completed. Ideally all primitive 
> parameters in ProcessContext should be injectable, and OutputReceiver 
> parameters can be used to collection output. So, we should be able to write a 
> DoFn as follows
> @ProcessElement
> public void process(@Element String word, OutputReceiver<String> receiver) {
>   receiver.output(word.toUpperCase());
> }



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to