当前位置: 首页>>代码示例>>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;未经允许,请勿转载。