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

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

                Author: ASF GitHub Bot
            Created on: 14/Feb/20 17:58
            Start Date: 14/Feb/20 17:58
    Worklog Time Spent: 10m 
      Work Description: dpmills commented on pull request #10862: [BEAM-9320] 
Add AlwaysFetched annotation
URL: https://github.com/apache/beam/pull/10862#discussion_r379566634
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFn.java
 ##########
 @@ -397,6 +397,47 @@ public Duration getAllowedTimestampSkew() {
     String value();
   }
 
+  /////////////////////////////////////////////////////////////////////////////
+
+  /**
+   * Annotation for declaring that a state parameter is always fetched.
+   *
+   * <p>A DoFn might not fetch a state value on every element, and for that 
reason runners may
+   * choose to defer fetching state until read() is called. Annotating a state 
argument with this
+   * parameter provides a hint to the runner that the state is always fetched. 
This may cause the
+   * runner to prefetch all the state before calling the processElement or 
processTimer method,
+   * improving performance. See the following code for an example:
 
 Review comment:
   Add a comment that the annotation only works for ReadableState
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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: 387516)
    Time Spent: 20m  (was: 10m)

> Add an annotation to State to indicate it should always be fetched
> ------------------------------------------------------------------
>
>                 Key: BEAM-9320
>                 URL: https://issues.apache.org/jira/browse/BEAM-9320
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Daniel Mills
>            Assignee: Reuven Lax
>            Priority: Minor
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently, if you have several StateIds that always need to be fetched for a 
> stateful DoFn, you have to have a block of .readLater() calls at the 
> beginning of each method.  It would be nicer to have an nnotation on the 
> processElement/processTimer call params to indicate that the value should 
> always be fetched.
> Something like:
> @ProcessElement
> void process(@RequiredStateId("foo") ValueState foo, E element) \{...}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to