Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,7 @@ private FlinkGroupAlsoByWindowWrapper(PipelineOptions options,
public void open() throws Exception {
super.open();
this.context = new ProcessContext(operator, new TimestampedCollector<>(output), this.timerInternals);
operator.startBundle(context);
}

/**
Expand DownExpand Up@@ -252,19 +253,23 @@ private <W extends BoundedWindow> DoFn<KeyedWorkItem<K, VIN>, KV<K, VOUT>> creat

private void processKeyedWorkItem(KeyedWorkItem<K, VIN> workItem) throws Exception {
context.setElement(workItem, getStateInternalsForKey(workItem.key()));

// TODO: Ideally startBundle/finishBundle would be called when the operator is first used / about to be discarded.
operator.startBundle(context);
operator.processElement(context);
operator.finishBundle(context);
}

@Override
public void processElement(StreamRecord<WindowedValue<KV<K, VIN>>> element) throws Exception {
ArrayList<WindowedValue<VIN>> elements = new ArrayList<>();
elements.add(WindowedValue.of(element.getValue().getValue().getValue(), element.getValue().getTimestamp(),
element.getValue().getWindows(), element.getValue().getPane()));
processKeyedWorkItem(KeyedWorkItems.elementsWorkItem(element.getValue().getValue().getKey(), elements));
final WindowedValue<KV<K, VIN>> windowedValue = element.getValue();
final KV<K, VIN> kv = windowedValue.getValue();

final WindowedValue<VIN> updatedWindowedValue = WindowedValue.of(kv.getValue(),
windowedValue.getTimestamp(),
windowedValue.getWindows(),
windowedValue.getPane());

processKeyedWorkItem(
KeyedWorkItems.elementsWorkItem(
kv.getKey(),
Collections.singletonList(updatedWindowedValue)));
}

@Override
Expand DownExpand Up@@ -309,6 +314,7 @@ public void processWatermark(Watermark mark) throws Exception {

@Override
public void close() throws Exception {
operator.finishBundle(context);
super.close();
}

Expand Down