本文整理匯總了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());
}