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

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

                Author: ASF GitHub Bot
            Created on: 23/Mar/20 16:57
            Start Date: 23/Mar/20 16:57
    Worklog Time Spent: 10m 
      Work Description: steveniemitz commented on pull request #11154: 
[BEAM-1819] Key should be available in @OnTimer methods
URL: https://github.com/apache/beam/pull/11154#discussion_r396604278
 
 

 ##########
 File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java
 ##########
 @@ -1155,6 +1156,10 @@ public Instant getStateStartTime() {
     // Note that TimerOrElementCoder is a backwards-compatibility class
     // that is really a FakeKeyedWorkItemCoder
     Coder<?> valueCoder = ((WindowedValueCoder<?>) readCoder).getValueCoder();
+
+    if (valueCoder instanceof KvCoder<?, ?>) {
+      return ((KvCoder<?, ?>) valueCoder).getKeyCoder();
+    }
 
 Review comment:
   without it, the key passed into the `WindmillStateInternals` constructor is 
always null.  This coder is used to deserialize the user key from the work item 
key here:
   
https://github.com/apache/beam/blob/master/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java#L1340
   
    It doesn't look like it was ever really used before other than for debug 
messages.
 
----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 408059)
    Time Spent: 10h  (was: 9h 50m)

> Key should be available in @OnTimer methods
> -------------------------------------------
>
>                 Key: BEAM-1819
>                 URL: https://issues.apache.org/jira/browse/BEAM-1819
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Thomas Groh
>            Assignee: Shehzaad Nakhoda
>            Priority: Major
>          Time Spent: 10h
>  Remaining Estimate: 0h
>
> Every timer firing has an associated key. This key should be available when 
> the timer is delivered to a user's {{DoFn}}, so they don't have to store it 
> in state.



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

Reply via email to