@Override public TimestampedValue<T> createAccumulator() { return TimestampedValue.atMinimumTimestamp(null); }
/** For non-timestamped elements. */ @SafeVarargs public final CreateStream<T> nextBatch(T... batchElements) { List<TimestampedValue<T>> timestamped = Lists.newArrayListWithCapacity(batchElements.length); // as TimestampedValue. for (T element : batchElements) { timestamped.add(TimestampedValue.atMinimumTimestamp(element)); } batches.offer(timestamped); return this; }
/** @deprecated Use {@link TestPipeline} with the {@code DirectRunner}. */ @Deprecated public void processElement(InputT element) throws Exception { processTimestampedElement(TimestampedValue.atMinimumTimestamp(element)); }
@Test public void testAtMinimumTimestamp() { TimestampedValue<String> tsv = TimestampedValue.atMinimumTimestamp("foobar"); assertEquals(BoundedWindow.TIMESTAMP_MIN_VALUE, tsv.getTimestamp()); }
@Test public void testNullValue() { TimestampedValue<String> tsv = TimestampedValue.atMinimumTimestamp(null); assertEquals(null, tsv.getValue()); }
@Test public void testCreateAccumulator() { assertEquals(TimestampedValue.atMinimumTimestamp(null), fn.createAccumulator()); }
@Test public void testAddInputMinTimestamp() { TimestampedValue<Long> input = TimestampedValue.atMinimumTimestamp(1234L); assertEquals(input, fn.addInput(fn.createAccumulator(), input)); }
@Test public void testMergeAccumulatorsEmptyIterable() { ArrayList<TimestampedValue<Long>> emptyAccums = Lists.newArrayList(); assertEquals(TimestampedValue.atMinimumTimestamp(null), fn.mergeAccumulators(emptyAccums)); }
.advanceWatermarkTo(new Instant(0)) .addElements( TimestampedValue.atMinimumTimestamp(4), TimestampedValue.atMinimumTimestamp(5), TimestampedValue.atMinimumTimestamp(6)) .advanceProcessingTime(Duration.standardMinutes(10)) .advanceWatermarkToInfinity();
@Test public void testEquality() { new EqualsTester() .addEqualityGroup( TimestampedValue.of("foo", new Instant(1000)), TimestampedValue.of("foo", new Instant(1000))) .addEqualityGroup(TimestampedValue.of("foo", new Instant(2000))) .addEqualityGroup(TimestampedValue.of("bar", new Instant(1000))) .addEqualityGroup( TimestampedValue.of("foo", BoundedWindow.TIMESTAMP_MIN_VALUE), TimestampedValue.atMinimumTimestamp("foo")) .testEquals(); }
TimestampedValue<Void> emptyElement = TimestampedValue.atMinimumTimestamp(null); PCollection<Integer> output = pipeline