@Override public void add(Instant outputTime) { combinedHold = combinedHold == null ? outputTime : timestampCombiner.combine(combinedHold, outputTime); }
/** Varargs variant of {@link #combine}. */ public final Instant combine(Instant... timestamps) { return combine(Arrays.asList(timestamps)); }
@ProcessElement public void processElement(ProcessContext context, BoundedWindow window) { WindowedStructuralKey<K> key = WindowedStructuralKey.create(keyCoder, context.element().getKey(), window); AccumT accumulator = accumulators.get(key); Instant assignedTs = timestampCombiner.assign(window, context.timestamp()); if (accumulator == null) { accumulator = combineFn.createAccumulator(); accumulators.put(key, accumulator); timestamps.put(key, assignedTs); } accumulators.put(key, combineFn.addInput(accumulator, context.element().getValue())); timestamps.put(key, timestampCombiner.combine(assignedTs, timestamps.get(key))); }
@Override public void add(Instant value) { try { org.apache.flink.api.common.state.ValueState<Instant> state = flinkStateBackend.getPartitionedState( namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor); Instant current = state.value(); if (current == null) { state.update(value); watermarkHolds.put(namespace.stringKey(), value); } else { Instant combined = timestampCombiner.combine(current, value); state.update(combined); watermarkHolds.put(namespace.stringKey(), combined); } } catch (Exception e) { throw new RuntimeException("Error updating state.", e); } }
@Override public void add(Instant value) { try { org.apache.flink.api.common.state.ValueState<Instant> state = flinkStateBackend.getPartitionedState( namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor); Instant current = state.value(); if (current == null) { state.update(value); watermarkHolds.put(namespace.stringKey(), value); } else { Instant combined = timestampCombiner.combine(current, value); state.update(combined); watermarkHolds.put(namespace.stringKey(), combined); } } catch (Exception e) { throw new RuntimeException("Error updating state.", e); } }
@Override public void add(Instant value) { try { org.apache.flink.api.common.state.ValueState<Instant> state = flinkStateBackend.getPartitionedState( namespace.stringKey(), StringSerializer.INSTANCE, flinkStateDescriptor); Instant current = state.value(); if (current == null) { state.update(value); flinkStateInternals.watermarkHolds.put(namespace.stringKey(), value); } else { Instant combined = timestampCombiner.combine(current, value); state.update(combined); flinkStateInternals.watermarkHolds.put(namespace.stringKey(), combined); } } catch (Exception e) { throw new RuntimeException("Error updating state.", e); } }
currentValue.getValue().getValue(), options, sideInputReader, singletonW); accumAndInstant.f1 = timestampCombiner.combine( accumAndInstant.f1, timestampCombiner.assign(
singletonW); accumAndInstant.f1 = timestampCombiner.combine( accumAndInstant.f1, timestampCombiner.assign(
singletonW); accumAndInstant.f1 = timestampCombiner.combine( accumAndInstant.f1, timestampCombiner.assign(
Instant timestamp = timestampCombiner.combine(t1, t2); return KV.of( timestamp, WindowedValue.of(wv1.getValue(), timestamp, mergedWindows, wv1.getPane()));
accumulator, nextValue.getValue().getValue(), ctxtForInput(nextValue)); windowTimestamp = timestampCombiner.combine( windowTimestamp, timestampCombiner.assign(
timestampCombiner.combine( windowTimestamp, timestampCombiner.assign(
timestampCombiner.combine( windowTimestamp, timestampCombiner.assign(
timestampCombiner.combine( windowTimestamp, timestampCombiner.assign(
assertThat(result2.getKey(), equalTo(timestampCombiner.combine(key1, key2))); Collection<? extends BoundedWindow> resultWindows = result2.getValue().getWindows(); assertThat(resultWindows.size(), equalTo(1));