alisha-1000 commented on code in PR #41519:
URL: https://github.com/apache/beam/pull/41519#discussion_r4695288782


##########
runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/stableinput/BufferingDoFnRunner.java:
##########
@@ -163,7 +202,8 @@ private BufferingDoFnRunner(
       @Nullable KeyedStateBackend keyedStateBackend,
       @Nullable Supplier<Locker> locker,
       @Nullable Function<InputT, Object> keySelector,
-      @Nullable Runnable finishBundleCallback)
+      @Nullable Runnable finishBundleCallback,
+      @Nullable Supplier<?> timerKeySupplier)

Review Comment:
   Thanks! Moved `timerKeySupplier` right after `keySelector` and dropped the 
extra `create(...)` overload, so DoFnOperator now calls the existing full one 
(this also reverts the reordering from d87b9c8). Done in 6070a09.
   
   On computing the key inside the runner: unfortunately it's not the same 
value. `keyedStateBackend.getCurrentKey()` returns a `FlinkKey`, i.e. the key 
encoded with `keyCoder`. The supplier is `keyedStateInternals.getKey()`, which 
decodes it into the user key, and that's what `onTimer` receives on the normal 
(non-buffered) timer path. For example, the new test's `@OnTimer` takes `@Key 
String`.
   
   BufferingDoFnRunner doesn't have the `keyCoder`, so it can't decode the key 
from the backend on its own. The alternative would be to pass the coder instead 
of the supplier, but that ties the runner to the `FlinkKey` format. Using a 
supplier also matches what ExecutableStageDoFnOperator already does for 
SdkHarnessDoFnRunner:
   `() -> FlinkKeyUtils.decodeKey(getCurrentKey().getSerializedKey(), keyCoder)`
   
   Happy to switch to the coder approach if you prefer.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to