[
https://issues.apache.org/jira/browse/BEAM-4681?focusedWorklogId=165351&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-165351
]
ASF GitHub Bot logged work on BEAM-4681:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Nov/18 10:18
Start Date: 13/Nov/18 10:18
Worklog Time Spent: 10m
Work Description: mxm commented on a change in pull request #7008:
[BEAM-4681] Add support for portable timers in Flink batch mode
URL: https://github.com/apache/beam/pull/7008#discussion_r232975079
##########
File path:
runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/ExecutableStageDoFnOperator.java
##########
@@ -270,8 +282,36 @@ public void setKeyContextElement1(StreamRecord record)
throws Exception {
@Override
public void setCurrentKey(Object key) {
- throw new UnsupportedOperationException(
- "Current key for state backend can only be set by state requests from
SDK workers.");
+ // We don't need to set anything, the key is set manually on the state
backend
+ // This will be called by HeapInternalTimerService before a timer is fired
+ if (!usesTimers) {
+ throw new UnsupportedOperationException(
+ "Current key for state backend can only be set by state requests
from SDK workers or when processing timers.");
+ }
+ }
+
+ @Override
+ public Object getCurrentKey() {
+ // This is the key retrieved by HeapInternalTimerService when setting a
Flink timer
+ return keyForTimerToBeSet;
+ }
+
+ @Override
+ public void fireTimer(InternalTimer<?, TimerInternals.TimerData> timer) {
+ // We need to decode the key
+ final ByteBuffer encodedKey = (ByteBuffer) timer.getKey();
+ @SuppressWarnings("ByteBufferBackingArray")
+ ByteArrayInputStream byteStream = new
ByteArrayInputStream(encodedKey.array());
+ final Object decodedKey;
+ try {
+ decodedKey = keyCoder.decode(byteStream);
+ } catch (IOException e) {
+ throw new RuntimeException(
+ String.format(Locale.ENGLISH, "Failed to decode encoded key: %s",
encodedKey));
Review comment:
Addressing this in #6981.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 165351)
Time Spent: 9.5h (was: 9h 20m)
> Integrate support for timers using the portability APIs into Flink
> ------------------------------------------------------------------
>
> Key: BEAM-4681
> URL: https://issues.apache.org/jira/browse/BEAM-4681
> Project: Beam
> Issue Type: Sub-task
> Components: runner-flink
> Reporter: Luke Cwik
> Assignee: Maximilian Michels
> Priority: Major
> Labels: portability, portability-flink
> Time Spent: 9.5h
> Remaining Estimate: 0h
>
> Consider using the code produced in BEAM-4658 to support timers.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)