本文整理汇总了Java中com.google.cloud.dataflow.sdk.transforms.Create.Values方法的典型用法代码示例。如果您正苦于以下问题:Java Create.Values方法的具体用法?Java Create.Values怎么用?Java Create.Values使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.cloud.dataflow.sdk.transforms.Create
的用法示例。
在下文中一共展示了Create.Values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.google.cloud.dataflow.sdk.transforms.Create; //导入方法依赖的package包/类
private static <T> TransformEvaluator<Create.Values<T>> create() {
return new TransformEvaluator<Create.Values<T>>() {
@SuppressWarnings("unchecked")
@Override
public void evaluate(Create.Values<T> transform, EvaluationContext context) {
StreamingEvaluationContext sec = (StreamingEvaluationContext) context;
Iterable<T> elems = transform.getElements();
Coder<T> coder = sec.getOutput(transform).getCoder();
if (coder != VoidCoder.of()) {
// actual create
sec.setOutputRDDFromValues(transform, elems, coder);
} else {
// fake create as an input
// creates a stream with a single batch containing a single null element
// to invoke following transformations once
// to support DataflowAssert
sec.setDStreamFromQueue(transform,
Collections.<Iterable<Void>>singletonList(Collections.singletonList((Void) null)),
(Coder<Void>) coder);
}
}
};
}
示例2: create
import com.google.cloud.dataflow.sdk.transforms.Create; //导入方法依赖的package包/类
private static <T> TransformEvaluator<Create.Values<T>> create() {
return new TransformEvaluator<Create.Values<T>>() {
@Override
public void evaluate(Create.Values<T> transform, EvaluationContext context) {
Iterable<T> elems = transform.getElements();
// Use a coder to convert the objects in the PCollection to byte arrays, so they
// can be transferred over the network.
Coder<T> coder = context.getOutput(transform).getCoder();
context.setOutputRDDFromValues(transform, elems, coder);
}
};
}