當前位置: 首頁>>代碼示例>>Java>>正文


Java SelectByMinFunction類代碼示例

本文整理匯總了Java中org.apache.flink.api.java.functions.SelectByMinFunction的典型用法代碼示例。如果您正苦於以下問題:Java SelectByMinFunction類的具體用法?Java SelectByMinFunction怎麽用?Java SelectByMinFunction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SelectByMinFunction類屬於org.apache.flink.api.java.functions包,在下文中一共展示了SelectByMinFunction類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: minBy

import org.apache.flink.api.java.functions.SelectByMinFunction; //導入依賴的package包/類
/**
 * Applies a special case of a reduce transformation (minBy) on a grouped {@link DataSet}.
 *
 * <p>The transformation consecutively calls a {@link ReduceFunction}
 * until only a single element remains which is the result of the transformation.
 * A ReduceFunction combines two elements into one new element of the same type.
 *
 * @param fields Keys taken into account for finding the minimum.
 * @return A {@link ReduceOperator} representing the minimum.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public ReduceOperator<T> minBy(int... fields)  {

	// Check for using a tuple
	if (!this.inputDataSet.getType().isTupleType()) {
		throw new InvalidProgramException("Method minBy(int) only works on tuples.");
	}

	return new ReduceOperator<T>(this, new SelectByMinFunction(
			(TupleTypeInfo) this.inputDataSet.getType(), fields), Utils.getCallLocationName());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:22,代碼來源:UnsortedGrouping.java

示例2: minBy

import org.apache.flink.api.java.functions.SelectByMinFunction; //導入依賴的package包/類
/**
 * Applies a special case of a reduce transformation (minBy) on a grouped {@link DataSet}.<br/>
 * The transformation consecutively calls a {@link ReduceFunction} 
 * until only a single element remains which is the result of the transformation.
 * A ReduceFunction combines two elements into one new element of the same type.
 *  
 * @param fields Keys taken into account for finding the minimum.
 * @return A {@link ReduceOperator} representing the minimum.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public ReduceOperator<T> minBy(int... fields)  {
	
	// Check for using a tuple
	if(!this.dataSet.getType().isTupleType()) {
		throw new InvalidProgramException("Method minBy(int) only works on tuples.");
	}
		
	return new ReduceOperator<T>(this, new SelectByMinFunction(
			(TupleTypeInfo) this.dataSet.getType(), fields));
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:21,代碼來源:UnsortedGrouping.java

示例3: minBy

import org.apache.flink.api.java.functions.SelectByMinFunction; //導入依賴的package包/類
/**
 * Applies a special case of a reduce transformation (minBy) on a non-grouped {@link DataSet}.<br/>
 * The transformation consecutively calls a {@link ReduceFunction} 
 * until only a single element remains which is the result of the transformation.
 * A ReduceFunction combines two elements into one new element of the same type.
 *  
 * @param fields Keys taken into account for finding the minimum.
 * @return A {@link ReduceOperator} representing the minimum.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public ReduceOperator<T> minBy(int... fields)  {
	
	// Check for using a tuple
	if(!this.type.isTupleType()) {
		throw new InvalidProgramException("Method minBy(int) only works on tuples.");
	}
		
	return new ReduceOperator<T>(this, new SelectByMinFunction(
			(TupleTypeInfo) this.type, fields));
}
 
開發者ID:citlab,項目名稱:vs.msc.ws14,代碼行數:21,代碼來源:DataSet.java

示例4: minBy

import org.apache.flink.api.java.functions.SelectByMinFunction; //導入依賴的package包/類
/**
 * Selects an element with minimum value.
 *
 * <p>The minimum is computed over the specified fields in lexicographical order.
 *
 * <p><strong>Example 1</strong>: Given a data set with elements <code>[0, 1], [1, 0]</code>, the
 * results will be:
 * <ul>
 * <li><code>minBy(0)</code>: <code>[0, 1]</code></li>
 * <li><code>minBy(1)</code>: <code>[1, 0]</code></li>
 * </ul>
 *
 * <p><strong>Example 2</strong>: Given a data set with elements <code>[0, 0], [0, 1]</code>, the
 * results will be:
 * <ul>
 * <li><code>minBy(0, 1)</code>: <code>[0, 0]</code></li>
 * </ul>
 *
 * <p>If multiple values with minimum value at the specified fields exist, a random one will be
 * picked.
 *
 * <p>Internally, this operation is implemented as a {@link ReduceFunction}.
 *
 * @param fields Field positions to compute the minimum over
 * @return A {@link ReduceOperator} representing the minimum
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public ReduceOperator<T> minBy(int... fields)  {
	if (!getType().isTupleType()) {
		throw new InvalidProgramException("DataSet#minBy(int...) only works on Tuple types.");
	}

	return new ReduceOperator<>(this, new SelectByMinFunction(
		(TupleTypeInfo) getType(), fields), Utils.getCallLocationName());
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:36,代碼來源:DataSet.java


注:本文中的org.apache.flink.api.java.functions.SelectByMinFunction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。