当前位置: 首页>>代码示例>>Java>>正文


Java IteratorInputFormat类代码示例

本文整理汇总了Java中org.apache.flink.api.java.io.IteratorInputFormat的典型用法代码示例。如果您正苦于以下问题:Java IteratorInputFormat类的具体用法?Java IteratorInputFormat怎么用?Java IteratorInputFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IteratorInputFormat类属于org.apache.flink.api.java.io包,在下文中一共展示了IteratorInputFormat类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromCollection

import org.apache.flink.api.java.io.IteratorInputFormat; //导入依赖的package包/类
/**
 * Creates a DataSet from the given iterator. Because the iterator will remain unmodified until
 * the actual execution happens, the type of data returned by the iterator must be given
 * explicitly in the form of the type information. This method is useful for cases where the type
 * is generic. In that case, the type class (as given in {@link #fromCollection(Iterator, Class)}
 * does not supply all type information.
 * <p>
 * The iterator must be serializable (as defined in {@link java.io.Serializable}), because the
 * framework may move it to a remote environment, if needed.
 * <p>
 * Note that this operation will result in a non-parallel data source, i.e. a data source with
 * a degree of parallelism of one.
 * 
 * @param data The collection of elements to create the data set from.
 * @param type The TypeInformation for the produced data set.
 * @return A DataSet representing the elements in the iterator.
 * 
 * @see #fromCollection(Iterator, Class)
 */
public <X> DataSource<X> fromCollection(Iterator<X> data, TypeInformation<X> type) {
	if (!(data instanceof Serializable)) {
		throw new IllegalArgumentException("The iterator must be serializable.");
	}
	
	return new DataSource<X>(this, new IteratorInputFormat<X>(data), type);
}
 
开发者ID:citlab,项目名称:vs.msc.ws14,代码行数:27,代码来源:ExecutionEnvironment.java

示例2: fromCollection

import org.apache.flink.api.java.io.IteratorInputFormat; //导入依赖的package包/类
/**
 * Creates a DataSet from the given iterator. Because the iterator will remain unmodified until
 * the actual execution happens, the type of data returned by the iterator must be given
 * explicitly in the form of the type information. This method is useful for cases where the type
 * is generic. In that case, the type class (as given in {@link #fromCollection(Iterator, Class)}
 * does not supply all type information.
 *
 * <p>Note that this operation will result in a non-parallel data source, i.e. a data source with
 * a parallelism of one.
 *
 * @param data The collection of elements to create the data set from.
 * @param type The TypeInformation for the produced data set.
 * @return A DataSet representing the elements in the iterator.
 *
 * @see #fromCollection(Iterator, Class)
 */
public <X> DataSource<X> fromCollection(Iterator<X> data, TypeInformation<X> type) {
	return new DataSource<>(this, new IteratorInputFormat<>(data), type, Utils.getCallLocationName());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:ExecutionEnvironment.java


注:本文中的org.apache.flink.api.java.io.IteratorInputFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。