diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java index 08e68369cfb5..cee327d493e0 100644 --- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java +++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/StreamingDataflowWorker.java @@ -1407,7 +1407,8 @@ public void close() { // The coder type that will be present is: // WindowedValueCoder(TimerOrElementCoder(KvCoder)) @Nullable Coder keyCoder = executionState.getKeyCoder(); - @Nullable Object executionKey = + @Nullable + Object executionKey = keyCoder == null ? null : keyCoder.decode(key.newInput(), Coder.Context.OUTER); if (workItem.hasHotKeyInfo()) {