[
https://issues.apache.org/jira/browse/BEAM-9562?focusedWorklogId=414816&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-414816
]
ASF GitHub Bot logged work on BEAM-9562:
----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Apr/20 16:17
Start Date: 02/Apr/20 16:17
Worklog Time Spent: 10m
Work Description: lukecwik commented on pull request #11199: [BEAM-9562]
Update Timer encoding with respect of dynamic timers
URL: https://github.com/apache/beam/pull/11199#discussion_r402433137
##########
File path:
runners/core-construction-java/src/test/java/org/apache/beam/runners/core/construction/TimerTest.java
##########
@@ -36,39 +38,121 @@
private static final Instant INSTANT = Instant.now();
@Test
- public void testTimer() {
- Timer<Void> timerA = Timer.of(INSTANT);
- assertEquals(INSTANT, timerA.getTimestamp());
- assertNull(timerA.getPayload());
+ public void testClearTimer() {
+ Timer<String> clearedTimer = Timer.cleared("timer", "tag");
+ assertTrue(clearedTimer.getClearBit());
+ assertEquals("timer", clearedTimer.getUserKey());
+ assertEquals("tag", clearedTimer.getDynamicTimerTag());
+ }
- Timer<String> timerB = Timer.of(INSTANT, "ABC");
- assertEquals(INSTANT, timerB.getTimestamp());
- assertEquals("ABC", timerB.getPayload());
+ @Test
+ public void testTimer() {
+ Timer<String> timer =
+ Timer.of(
+ "key",
+ "tag",
+ INSTANT,
+ INSTANT,
+ Collections.singleton(GlobalWindow.INSTANCE),
+ PaneInfo.NO_FIRING);
+ assertEquals("key", timer.getUserKey());
+ assertEquals("tag", timer.getDynamicTimerTag());
+ assertEquals(INSTANT, timer.getFireTimestamp());
+ assertEquals(INSTANT, timer.getHoldTimestamp());
+ assertEquals(Collections.singleton(GlobalWindow.INSTANCE),
timer.getWindows());
+ assertEquals(PaneInfo.NO_FIRING, timer.getPane());
+ assertFalse(timer.getClearBit());
}
@Test
- public void testTimerCoderWithInconsistentWithEqualsPayloadCoder() throws
Exception {
- Coder<Timer<byte[]>> coder = Timer.Coder.of(ByteArrayCoder.of());
+ public void testTimerCoderWithInconsistentWithEqualsComponentCoders() throws
Exception {
+ Coder<Timer<String>> coder = Timer.Coder.of(StringUtf8Coder.of(),
GlobalWindow.Coder.INSTANCE);
CoderProperties.coderSerializable(coder);
CoderProperties.structuralValueDecodeEncodeEqual(
- coder, Timer.of(INSTANT, "ABC".getBytes(UTF_8)));
+ coder,
+ Timer.of(
+ "key",
+ "tag",
+ INSTANT,
+ INSTANT,
+ Collections.singleton(GlobalWindow.INSTANCE),
+ PaneInfo.NO_FIRING));
CoderProperties.structuralValueConsistentWithEquals(
- coder, Timer.of(INSTANT, "ABC".getBytes(UTF_8)), Timer.of(INSTANT,
"ABC".getBytes(UTF_8)));
+ coder,
+ Timer.of(
+ "key",
+ "tag",
+ INSTANT,
+ INSTANT,
+ Collections.singleton(GlobalWindow.INSTANCE),
+ PaneInfo.NO_FIRING),
+ Timer.of(
+ "key",
+ "tag",
+ INSTANT,
+ INSTANT,
+ Collections.singleton(GlobalWindow.INSTANCE),
+ PaneInfo.NO_FIRING));
}
@Test
- public void testTimerCoderWithConsistentWithEqualsPayloadCoder() throws
Exception {
- Coder<Timer<String>> coder = Timer.Coder.of(StringUtf8Coder.of());
- CoderProperties.coderDecodeEncodeEqual(coder, Timer.of(INSTANT, "ABC"));
+ public void testTimerCoderWithConsistentWithEqualsComponentCoders() throws
Exception {
+ Coder<Timer<String>> coder = Timer.Coder.of(StringUtf8Coder.of(),
GlobalWindow.Coder.INSTANCE);
Review comment:
Add a cleared timer for this case.
----------------------------------------------------------------
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: 414816)
> Remove timer from PCollection and treat timers as Elements
> -----------------------------------------------------------
>
> Key: BEAM-9562
> URL: https://issues.apache.org/jira/browse/BEAM-9562
> Project: Beam
> Issue Type: New Feature
> Components: sdk-py-harness
> Reporter: Boyuan Zhang
> Assignee: Boyuan Zhang
> Priority: Major
> Time Spent: 9h 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)