當前位置: 首頁>>代碼示例>>Java>>正文


Java TestStream.Builder方法代碼示例

本文整理匯總了Java中org.apache.beam.sdk.testing.TestStream.Builder方法的典型用法代碼示例。如果您正苦於以下問題:Java TestStream.Builder方法的具體用法?Java TestStream.Builder怎麽用?Java TestStream.Builder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.beam.sdk.testing.TestStream的用法示例。


在下文中一共展示了TestStream.Builder方法的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());
}
 
開發者ID:apache,項目名稱:beam,代碼行數:16,代碼來源:MockedUnboundedTable.java

示例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());
}
 
開發者ID:apache,項目名稱:beam,代碼行數:12,代碼來源:BeamSqlDslBase.java

示例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());
}
 
開發者ID:apache,項目名稱:beam,代碼行數:11,代碼來源:BeamSqlDslBase.java


注:本文中的org.apache.beam.sdk.testing.TestStream.Builder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。