當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。