本文整理了Java中org.apache.beam.sdk.transforms.windowing.Window.getWindowFn()
方法的一些代码示例,展示了Window.getWindowFn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.getWindowFn()
方法的具体详情如下:
包路径:org.apache.beam.sdk.transforms.windowing.Window
类名称:Window
方法名:getWindowFn
暂无
代码示例来源:origin: apache/incubator-nemo
/**
* @param ctx provides translation context
* @param beamNode the beam node to be translated
* @param transform transform which can be obtained from {@code beamNode}
*/
@PrimitiveTransformTranslator({Window.class, Window.Assign.class})
private static void windowTranslator(final PipelineTranslationContext ctx,
final TransformHierarchy.Node beamNode,
final PTransform<?, ?> transform) {
final WindowFn windowFn;
if (transform instanceof Window) {
windowFn = ((Window) transform).getWindowFn();
} else if (transform instanceof Window.Assign) {
windowFn = ((Window.Assign) transform).getWindowFn();
} else {
throw new UnsupportedOperationException(String.format("%s is not supported", transform));
}
final IRVertex vertex = new OperatorVertex(
new WindowFnTransform(windowFn, DisplayData.from(beamNode.getTransform())));
ctx.addVertex(vertex);
beamNode.getInputs().values().forEach(input -> ctx.addEdgeTo(vertex, input));
beamNode.getOutputs().values().forEach(output -> ctx.registerMainOutputFrom(beamNode, vertex, output));
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
@Override
public PCollection<T> expand(PCollection<T> input) {
applicableTo(input);
WindowingStrategy<?, ?> outputStrategy =
getOutputStrategyInternal(input.getWindowingStrategy());
if (getWindowFn() == null) {
// A new PCollection must be created in case input is reused in a different location as the
// two PCollections will, in general, have a different windowing strategy.
return PCollectionList.of(input)
.apply(Flatten.pCollections())
.setWindowingStrategyInternal(outputStrategy);
} else {
// This is the AssignWindows primitive
return input.apply(new Assign<>(this, outputStrategy));
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
/** Get the output strategy of this {@link Window Window PTransform}. For internal use only. */
public WindowingStrategy<?, ?> getOutputStrategyInternal(WindowingStrategy<?, ?> inputStrategy) {
WindowingStrategy<?, ?> result = inputStrategy;
if (getWindowFn() != null) {
result = result.withWindowFn(getWindowFn());
}
if (getTrigger() != null) {
result = result.withTrigger(getTrigger());
}
if (getAccumulationMode() != null) {
result = result.withMode(getAccumulationMode());
}
if (getAllowedLateness() != null) {
result =
result.withAllowedLateness(
Ordering.natural().max(getAllowedLateness(), inputStrategy.getAllowedLateness()));
}
if (getClosingBehavior() != null) {
result = result.withClosingBehavior(getClosingBehavior());
}
if (getOnTimeBehavior() != null) {
result = result.withOnTimeBehavior(getOnTimeBehavior());
}
if (getTimestampCombiner() != null) {
result = result.withTimestampCombiner(getTimestampCombiner());
}
return result;
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-core
super.populateDisplayData(builder);
if (getWindowFn() != null) {
builder
.add(
DisplayData.item("windowFn", getWindowFn().getClass())
.withLabel("Windowing Function"))
.include("windowFn", getWindowFn());
内容来源于网络,如有侵权,请联系作者删除!