org.apache.flink.streaming.api.datastream.KeyedStream.aggregate()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(13.9k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.apache.flink.streaming.api.datastream.KeyedStream.aggregate()方法的一些代码示例,展示了KeyedStream.aggregate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyedStream.aggregate()方法的具体详情如下:
包路径:org.apache.flink.streaming.api.datastream.KeyedStream
类名称:KeyedStream
方法名:aggregate

KeyedStream.aggregate介绍

暂无

代码示例

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives a rolling sum of the data stream at the
 * given position grouped by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToSum
 *            The field position in the data points to sum. This is applicable to
 *            Tuple types, basic and primitive array types, Scala case classes,
 *            and primitive types (which is considered as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> sum(int positionToSum) {
  return aggregate(new SumAggregator<>(positionToSum, getType(), getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current maximum of the data stream
 * at the given position by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToMax
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> max(int positionToMax) {
  return aggregate(new ComparableAggregator<>(positionToMax, getType(), AggregationFunction.AggregationType.MAX,
      getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current minimum of the data
 * stream at the given position by the given key. An independent aggregate
 * is kept per key.
 *
 * @param positionToMin
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> min(int positionToMin) {
  return aggregate(new ComparableAggregator<>(positionToMin, getType(), AggregationFunction.AggregationType.MIN,
      getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current sum of the data
 * stream at the given field by the given key. An independent
 * aggregate is kept per key.
 *
 * @param field
 *            In case of a POJO, Scala case class, or Tuple type, the
 *            name of the (public) field on which to perform the aggregation.
 *            Additionally, a dot can be used to drill down into nested
 *            objects, as in {@code "field1.fieldxy" }.
 *            Furthermore "*" can be specified in case of a basic type
 *            (which is considered as having only one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> sum(String field) {
  return aggregate(new SumAggregator<>(field, getType(), getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current element with the
 * maximum value at the given position by the given key. An independent
 * aggregate is kept per key. If more elements have the maximum value at the
 * given position, the operator returns either the first or last one,
 * depending on the parameter set.
 *
 * @param positionToMaxBy
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @param first
 *            If true, then the operator return the first element with the
 *            maximum value, otherwise returns the last
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> maxBy(int positionToMaxBy, boolean first) {
  return aggregate(new ComparableAggregator<>(positionToMaxBy, getType(), AggregationFunction.AggregationType.MAXBY, first,
      getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current element with the
 * minimum value at the given position by the given key. An independent
 * aggregate is kept per key. If more elements have the minimum value at the
 * given position, the operator returns either the first or last one,
 * depending on the parameter set.
 *
 * @param positionToMinBy
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @param first
 *            If true, then the operator return the first element with the
 *            minimal value, otherwise returns the last
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> minBy(int positionToMinBy, boolean first) {
  return aggregate(new ComparableAggregator<T>(positionToMinBy, getType(), AggregationFunction.AggregationType.MINBY, first,
      getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current minimum of the
 * data stream at the given field expression by the given key. An
 * independent aggregate is kept per key. A field expression is either the
 * name of a public field or a getter method with parentheses of the
 * {@link DataStream}'s underlying type. A dot can be used to drill down into
 * objects, as in {@code "field1.fieldxy" }.
 *
 * @param field
 *            In case of a POJO, Scala case class, or Tuple type, the
 *            name of the (public) field on which to perform the aggregation.
 *            Additionally, a dot can be used to drill down into nested
 *            objects, as in {@code "field1.fieldxy" }.
 *            Furthermore "*" can be specified in case of a basic type
 *            (which is considered as having only one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> min(String field) {
  return aggregate(new ComparableAggregator<>(field, getType(), AggregationFunction.AggregationType.MIN,
      false, getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current maximum of the
 * data stream at the given field expression by the given key. An
 * independent aggregate is kept per key. A field expression is either the
 * name of a public field or a getter method with parentheses of the
 * {@link DataStream}'s underlying type. A dot can be used to drill down into
 * objects, as in {@code "field1.fieldxy" }.
 *
 * @param field
 *            In case of a POJO, Scala case class, or Tuple type, the
 *            name of the (public) field on which to perform the aggregation.
 *            Additionally, a dot can be used to drill down into nested
 *            objects, as in {@code "field1.fieldxy" }.
 *            Furthermore "*" can be specified in case of a basic type
 *            (which is considered as having only one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> max(String field) {
  return aggregate(new ComparableAggregator<>(field, getType(), AggregationFunction.AggregationType.MAX,
      false, getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current maximum element of the
 * data stream by the given field expression by the given key. An
 * independent aggregate is kept per key. A field expression is either the
 * name of a public field or a getter method with parentheses of the
 * {@link DataStream}'s underlying type. A dot can be used to drill down into
 * objects, as in {@code "field1.fieldxy" }.
 *
 * @param field
 *            In case of a POJO, Scala case class, or Tuple type, the
 *            name of the (public) field on which to perform the aggregation.
 *            Additionally, a dot can be used to drill down into nested
 *            objects, as in {@code "field1.fieldxy" }.
 *            Furthermore "*" can be specified in case of a basic type
 *            (which is considered as having only one field).
 * @param first
 *            If True then in case of field equality the first object will
 *            be returned
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> maxBy(String field, boolean first) {
  return aggregate(new ComparableAggregator<>(field, getType(), AggregationFunction.AggregationType.MAXBY,
      first, getExecutionConfig()));
}

代码示例来源:origin: apache/flink

/**
 * Applies an aggregation that gives the current minimum element of the
 * data stream by the given field expression by the given key. An
 * independent aggregate is kept per key. A field expression is either the
 * name of a public field or a getter method with parentheses of the
 * {@link DataStream}'s underlying type. A dot can be used to drill down into
 * objects, as in {@code "field1.fieldxy" }.
 *
 * @param field
 *            In case of a POJO, Scala case class, or Tuple type, the
 *            name of the (public) field on which to perform the aggregation.
 *            Additionally, a dot can be used to drill down into nested
 *            objects, as in {@code "field1.fieldxy" }.
 *            Furthermore "*" can be specified in case of a basic type
 *            (which is considered as having only one field).
 * @param first
 *            If True then in case of field equality the first object will
 *            be returned
 * @return The transformed DataStream.
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public SingleOutputStreamOperator<T> minBy(String field, boolean first) {
  return aggregate(new ComparableAggregator(field, getType(), AggregationFunction.AggregationType.MINBY,
      first, getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Applies an aggregation that gives a rolling sum of the data stream at the
 * given position grouped by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToSum
 *            The field position in the data points to sum. This is applicable to
 *            Tuple types, basic and primitive array types, Scala case classes,
 *            and primitive types (which is considered as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> sum(int positionToSum) {
  return aggregate(new SumAggregator<>(positionToSum, getType(), getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies an aggregation that gives a rolling sum of the data stream at the
 * given position grouped by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToSum
 *            The field position in the data points to sum. This is applicable to
 *            Tuple types, basic and primitive array types, Scala case classes,
 *            and primitive types (which is considered as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> sum(int positionToSum) {
  return aggregate(new SumAggregator<>(positionToSum, getType(), getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Applies an aggregation that gives a rolling sum of the data stream at the
 * given position grouped by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToSum
 *            The field position in the data points to sum. This is applicable to
 *            Tuple types, basic and primitive array types, Scala case classes,
 *            and primitive types (which is considered as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> sum(int positionToSum) {
  return aggregate(new SumAggregator<>(positionToSum, getType(), getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies an aggregation that gives the current minimum of the data
 * stream at the given position by the given key. An independent aggregate
 * is kept per key.
 *
 * @param positionToMin
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> min(int positionToMin) {
  return aggregate(new ComparableAggregator<>(positionToMin, getType(), AggregationFunction.AggregationType.MIN,
      getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Applies an aggregation that gives the current minimum of the data
 * stream at the given position by the given key. An independent aggregate
 * is kept per key.
 *
 * @param positionToMin
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> min(int positionToMin) {
  return aggregate(new ComparableAggregator<>(positionToMin, getType(), AggregationFunction.AggregationType.MIN,
      getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11

/**
 * Applies an aggregation that gives the current maximum of the data stream
 * at the given position by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToMax
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> max(int positionToMax) {
  return aggregate(new ComparableAggregator<>(positionToMax, getType(), AggregationFunction.AggregationType.MAX,
      getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies an aggregation that gives the current maximum of the data stream
 * at the given position by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToMax
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> max(int positionToMax) {
  return aggregate(new ComparableAggregator<>(positionToMax, getType(), AggregationFunction.AggregationType.MAX,
      getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Applies an aggregation that gives the current minimum of the data
 * stream at the given position by the given key. An independent aggregate
 * is kept per key.
 *
 * @param positionToMin
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> min(int positionToMin) {
  return aggregate(new ComparableAggregator<>(positionToMin, getType(), AggregationFunction.AggregationType.MIN,
      getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java

/**
 * Applies an aggregation that gives the current maximum of the data stream
 * at the given position by the given key. An independent aggregate is kept
 * per key.
 *
 * @param positionToMax
 *            The field position in the data points to minimize. This is applicable to
 *            Tuple types, Scala case classes, and primitive types (which is considered
 *            as having one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> max(int positionToMax) {
  return aggregate(new ComparableAggregator<>(positionToMax, getType(), AggregationFunction.AggregationType.MAX,
      getExecutionConfig()));
}

代码示例来源:origin: org.apache.flink/flink-streaming-java_2.10

/**
 * Applies an aggregation that gives the current sum of the data
 * stream at the given field by the given key. An independent
 * aggregate is kept per key.
 *
 * @param field
 *            In case of a POJO, Scala case class, or Tuple type, the
 *            name of the (public) field on which to perform the aggregation.
 *            Additionally, a dot can be used to drill down into nested
 *            objects, as in {@code "field1.fieldxy" }.
 *            Furthermore "*" can be specified in case of a basic type
 *            (which is considered as having only one field).
 * @return The transformed DataStream.
 */
public SingleOutputStreamOperator<T> sum(String field) {
  return aggregate(new SumAggregator<>(field, getType(), getExecutionConfig()));
}

相关文章