-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[Drain] OnTimer - propagate caused by drain bit up to DoFnRunner #37012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,7 @@ | |
| import org.apache.beam.sdk.transforms.windowing.PaneInfo; | ||
| import org.apache.beam.sdk.util.OutputBuilderSuppliers; | ||
| import org.apache.beam.sdk.util.WindowedValueMultiReceiver; | ||
| import org.apache.beam.sdk.values.CausedByDrain; | ||
| import org.apache.beam.sdk.values.KV; | ||
| import org.apache.beam.sdk.values.PCollectionView; | ||
| import org.apache.beam.sdk.values.Row; | ||
|
|
@@ -396,6 +397,11 @@ public PaneInfo pane() { | |
| return element.getRecordOffset(); | ||
| } | ||
|
|
||
| @Override | ||
| public CausedByDrain causedByDrain() { | ||
| return CausedByDrain.NORMAL; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this come from the element metadata? |
||
| } | ||
|
|
||
| @Override | ||
| public PipelineOptions getPipelineOptions() { | ||
| return pipelineOptions; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import org.apache.beam.sdk.state.TimeDomain; | ||
| import org.apache.beam.sdk.transforms.DoFn; | ||
| import org.apache.beam.sdk.transforms.windowing.BoundedWindow; | ||
| import org.apache.beam.sdk.values.CausedByDrain; | ||
| import org.apache.beam.sdk.values.PCollectionView; | ||
| import org.apache.beam.sdk.values.WindowedValue; | ||
| import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList; | ||
|
|
@@ -116,7 +117,15 @@ public <KeyT> void onTimer( | |
| Instant timestamp, | ||
| Instant outputTimestamp, | ||
| TimeDomain timeDomain) { | ||
| underlying.onTimer(timerId, timerFamilyId, key, window, timestamp, outputTimestamp, timeDomain); | ||
| underlying.onTimer( | ||
| timerId, | ||
| timerFamilyId, | ||
| key, | ||
| window, | ||
| timestamp, | ||
| outputTimestamp, | ||
| timeDomain, | ||
| CausedByDrain.NORMAL); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should propagate here? will that be a follow-up that adds it to the pushback side input DoFnRunner? |
||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,7 +141,8 @@ public void testOnTimerExceptionsWrappedAsUserCodeException() { | |
| GlobalWindow.INSTANCE, | ||
| new Instant(0), | ||
| new Instant(0), | ||
| TimeDomain.EVENT_TIME); | ||
| TimeDomain.EVENT_TIME, | ||
| CausedByDrain.NORMAL); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this unit test file should test caused by drain propagation somehow? |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -266,7 +267,8 @@ public void testOnTimerCalled() { | |
| GlobalWindow.INSTANCE, | ||
| currentTime.plus(offset), | ||
| currentTime.plus(offset), | ||
| TimeDomain.EVENT_TIME); | ||
| TimeDomain.EVENT_TIME, | ||
| CausedByDrain.NORMAL); | ||
|
|
||
| assertThat( | ||
| fn.onTimerInvocations, | ||
|
|
@@ -277,7 +279,8 @@ public void testOnTimerCalled() { | |
| StateNamespaces.window(windowFn.windowCoder(), GlobalWindow.INSTANCE), | ||
| currentTime.plus(offset), | ||
| currentTime.plus(offset), | ||
| TimeDomain.EVENT_TIME))); | ||
| TimeDomain.EVENT_TIME, | ||
| CausedByDrain.NORMAL))); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -593,7 +596,8 @@ public void testOnTimerAllowedSkew() { | |
| GlobalWindow.INSTANCE, | ||
| new Instant(0), | ||
| new Instant(0), | ||
| TimeDomain.EVENT_TIME); | ||
| TimeDomain.EVENT_TIME, | ||
| CausedByDrain.NORMAL); | ||
| } | ||
|
|
||
| @Test | ||
|
|
@@ -625,7 +629,8 @@ public void testOnTimerNoSkew() { | |
| GlobalWindow.INSTANCE, | ||
| new Instant(0), | ||
| new Instant(0), | ||
| TimeDomain.EVENT_TIME); | ||
| TimeDomain.EVENT_TIME, | ||
| CausedByDrain.NORMAL); | ||
| }); | ||
|
|
||
| assertThat(exception.getCause(), isA(IllegalArgumentException.class)); | ||
|
|
@@ -703,7 +708,7 @@ public void onTimer(OnTimerContext context) { | |
| context.fireTimestamp(), | ||
| context.timestamp(), | ||
| context.timeDomain(), | ||
| CausedByDrain.NORMAL)); | ||
| context.causedByDrain())); | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this come from the element metadata?