[
https://issues.apache.org/jira/browse/BEAM-7951?focusedWorklogId=362687&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-362687
]
ASF GitHub Bot logged work on BEAM-7951:
----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Dec/19 19:53
Start Date: 23/Dec/19 19:53
Worklog Time Spent: 10m
Work Description: lukecwik commented on pull request #9979: [BEAM-7951]
Allow runner to configure customization WindowedValue coder.
URL: https://github.com/apache/beam/pull/9979#discussion_r360982612
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
##########
@@ -693,4 +707,181 @@ public void registerByteSizeObserver(WindowedValue<T>
value, ElementByteSizeObse
return Collections.singletonList(valueCoder);
}
}
+
+ /**
+ * A parameterized Coder for {@code WindowedValue}.
+ *
+ * <p>A {@code ParamWindowedValueCoder} only encodes and decodes the value.
It drops timestamp,
+ * windows, and pane info during encoding, and uses the supplied
parameterized timestamp, windows
+ * and pane info values during decoding when reconstructing the windowed
value.
+ */
+ public static class ParamWindowedValueCoder<T> extends
FullWindowedValueCoder<T> {
+
+ private static final long serialVersionUID = 1L;
+
+ private transient Instant timestamp;
+ private transient Collection<? extends BoundedWindow> windows;
+ private transient PaneInfo pane;
+
+ private static final byte[] EMPTY_BYTES = new byte[0];
+
+ /**
+ * Returns the {@link ParamWindowedValueCoder} from the given valueCoder,
windowCoder and the
+ * supplied parameterized timestamp, windows and pane info for {@link
WindowedValue}.
+ */
+ public static <T> ParamWindowedValueCoder<T> of(
+ Coder<T> valueCoder,
+ Coder<? extends BoundedWindow> windowCoder,
+ Instant timestamp,
+ Collection<? extends BoundedWindow> windows,
+ PaneInfo pane) {
+ return new ParamWindowedValueCoder<>(valueCoder, windowCoder, timestamp,
windows, pane);
+ }
+
+ /**
+ * Returns the {@link ParamWindowedValueCoder} from the given valueCoder,
windowCoder and the
Review comment:
```suggestion
* Returns the {@link ParamWindowedValueCoder} for the given valueCoder
and windowCoder using
```
----------------------------------------------------------------
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: 362687)
Time Spent: 8h 20m (was: 8h 10m)
> Allow runner to configure customization WindowedValue coder such as
> ValueOnlyWindowedValueCoder
> -----------------------------------------------------------------------------------------------
>
> Key: BEAM-7951
> URL: https://issues.apache.org/jira/browse/BEAM-7951
> Project: Beam
> Issue Type: Sub-task
> Components: java-fn-execution
> Reporter: sunjincheng
> Assignee: sunjincheng
> Priority: Major
> Time Spent: 8h 20m
> Remaining Estimate: 0h
>
> The coder of WindowedValue cannot be configured and it’s always
> FullWindowedValueCoder. We don't need to serialize the timestamp, window and
> pane properties in Flink and so it will be better to make the coder
> configurable (i.e. allowing to use ValueOnlyWindowedValueCoder)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)