stankiewicz commented on code in PR #36373:
URL: https://github.com/apache/beam/pull/36373#discussion_r2426725490
##########
sdks/java/core/src/test/java/org/apache/beam/sdk/util/WindowedValueTest.java:
##########
@@ -77,6 +77,32 @@ public void testWindowedValueCoder() throws CoderException {
Assert.assertArrayEquals(value.getWindows().toArray(),
decodedValue.getWindows().toArray());
}
+ @Test
+ public void testWindowedValueWithElementMetadataCoder() throws
CoderException {
+ WindowedValues.WindowedValueCoder.setMetadataSupported();
+ Instant timestamp = new Instant(1234);
+ WindowedValue<String> value =
+ WindowedValues.of(
+ "abc",
+ new Instant(1234),
+ Arrays.asList(
+ new IntervalWindow(timestamp,
timestamp.plus(Duration.millis(1000))),
+ new IntervalWindow(
+ timestamp.plus(Duration.millis(1000)),
timestamp.plus(Duration.millis(2000)))),
+ PaneInfo.NO_FIRING);
+
+ Coder<WindowedValue<String>> windowedValueCoder =
+ WindowedValues.getFullCoder(StringUtf8Coder.of(),
IntervalWindow.getCoder());
+
+ byte[] encodedValue = CoderUtils.encodeToByteArray(windowedValueCoder,
value);
+ WindowedValue<String> decodedValue =
+ CoderUtils.decodeFromByteArray(windowedValueCoder, encodedValue);
+
+ Assert.assertEquals(value.getValue(), decodedValue.getValue());
+ Assert.assertEquals(value.getTimestamp(), decodedValue.getTimestamp());
+ Assert.assertArrayEquals(value.getWindows().toArray(),
decodedValue.getWindows().toArray());
Review Comment:
but it tests actual serde with metadata (even empty)
--
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]