本文整理汇总了Java中org.apache.flink.api.common.functions.util.CopyingIterator类的典型用法代码示例。如果您正苦于以下问题:Java CopyingIterator类的具体用法?Java CopyingIterator怎么用?Java CopyingIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CopyingIterator类属于org.apache.flink.api.common.functions.util包,在下文中一共展示了CopyingIterator类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeOnCollections
import org.apache.flink.api.common.functions.util.CopyingIterator; //导入依赖的package包/类
@Override
protected List<OUT> executeOnCollections(List<IN> inputData, RuntimeContext ctx, ExecutionConfig executionConfig) throws Exception {
MapPartitionFunction<IN, OUT> function = this.userFunction.getUserCodeObject();
FunctionUtils.setFunctionRuntimeContext(function, ctx);
FunctionUtils.openFunction(function, this.parameters);
ArrayList<OUT> result = new ArrayList<OUT>(inputData.size() / 4);
TypeSerializer<IN> inSerializer = getOperatorInfo().getInputType().createSerializer(executionConfig);
TypeSerializer<OUT> outSerializer = getOperatorInfo().getOutputType().createSerializer(executionConfig);
CopyingIterator<IN> source = new CopyingIterator<IN>(inputData.iterator(), inSerializer);
CopyingListCollector<OUT> resultCollector = new CopyingListCollector<OUT>(result, outSerializer);
function.mapPartition(source, resultCollector);
result.trimToSize();
FunctionUtils.closeFunction(function);
return result;
}