本文整理汇总了Java中org.apache.beam.sdk.testing.TestStream.create方法的典型用法代码示例。如果您正苦于以下问题:Java TestStream.create方法的具体用法?Java TestStream.create怎么用?Java TestStream.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.beam.sdk.testing.TestStream
的用法示例。
在下文中一共展示了TestStream.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildIOReader
import org.apache.beam.sdk.testing.TestStream; //导入方法依赖的package包/类
@Override public PCollection<BeamRecord> buildIOReader(Pipeline pipeline) {
TestStream.Builder<BeamRecord> values = TestStream.create(beamRecordSqlType.getRecordCoder());
for (Pair<Duration, List<BeamRecord>> pair : timestampedRows) {
values = values.advanceWatermarkTo(new Instant(0).plus(pair.getKey()));
for (int i = 0; i < pair.getValue().size(); i++) {
values = values.addElements(TimestampedValue.of(pair.getValue().get(i),
new Instant(pair.getValue().get(i).getDate(timestampField))));
}
}
return pipeline.begin().apply(
"MockedUnboundedTable_" + COUNTER.incrementAndGet(),
values.advanceWatermarkToInfinity());
}
示例2: prepareUnboundedPCollection1
import org.apache.beam.sdk.testing.TestStream; //导入方法依赖的package包/类
private PCollection<BeamRecord> prepareUnboundedPCollection1() {
TestStream.Builder<BeamRecord> values = TestStream
.create(rowTypeInTableA.getRecordCoder());
for (BeamRecord row : recordsInTableA) {
values = values.advanceWatermarkTo(new Instant(row.getDate("f_timestamp")));
values = values.addElements(row);
}
return PBegin.in(pipeline).apply("unboundedInput1", values.advanceWatermarkToInfinity());
}
示例3: prepareUnboundedPCollection2
import org.apache.beam.sdk.testing.TestStream; //导入方法依赖的package包/类
private PCollection<BeamRecord> prepareUnboundedPCollection2() {
TestStream.Builder<BeamRecord> values = TestStream
.create(rowTypeInTableA.getRecordCoder());
BeamRecord row = recordsInTableA.get(0);
values = values.advanceWatermarkTo(new Instant(row.getDate("f_timestamp")));
values = values.addElements(row);
return PBegin.in(pipeline).apply("unboundedInput2", values.advanceWatermarkToInfinity());
}