本文整理汇总了Java中org.apache.beam.sdk.transforms.DoFn.ProcessElement方法的典型用法代码示例。如果您正苦于以下问题:Java DoFn.ProcessElement方法的具体用法?Java DoFn.ProcessElement怎么用?Java DoFn.ProcessElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.beam.sdk.transforms.DoFn
的用法示例。
在下文中一共展示了DoFn.ProcessElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDoFnWithReturn
import org.apache.beam.sdk.transforms.DoFn; //导入方法依赖的package包/类
@Test
public void testDoFnWithReturn() throws Exception {
class MockFn extends DoFn<String, String> {
@DoFn.ProcessElement
public ProcessContinuation processElement(ProcessContext c, SomeRestrictionTracker tracker)
throws Exception {
return null;
}
@GetInitialRestriction
public SomeRestriction getInitialRestriction(String element) {
return null;
}
@NewTracker
public SomeRestrictionTracker newTracker(SomeRestriction restriction) {
return null;
}
}
MockFn fn = mock(MockFn.class);
when(fn.processElement(mockProcessContext, null)).thenReturn(resume());
assertEquals(resume(), invokeProcessElement(fn));
}
示例2: processElement
import org.apache.beam.sdk.transforms.DoFn; //导入方法依赖的package包/类
@DoFn.ProcessElement
public void processElement(ProcessContext c) {
DateTime timestamp = c.timestamp().toDateTime();
String timestampStr = formatter.print(timestamp);
TableRow row = new TableRow()
.set(TIMESTAMP_COLUMN_NAME, timestampStr)
.set(MESSAGE_COLUMN_NAME, c.element());
c.output(row);
}
示例3: testDoFnWithWindow
import org.apache.beam.sdk.transforms.DoFn; //导入方法依赖的package包/类
@Test
public void testDoFnWithWindow() throws Exception {
class MockFn extends DoFn<String, String> {
@DoFn.ProcessElement
public void processElement(ProcessContext c, IntervalWindow w) throws Exception {}
}
MockFn fn = mock(MockFn.class);
assertEquals(stop(), invokeProcessElement(fn));
verify(fn).processElement(mockProcessContext, mockWindow);
}
示例4: processElement
import org.apache.beam.sdk.transforms.DoFn; //导入方法依赖的package包/类
@DoFn.ProcessElement
void processElement(DoFn<String, String>.ProcessContext c);