flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #1975: [FLINK-2184] Cannot get last element with maxBy/mi...
Date Thu, 13 Oct 2016 21:49:40 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1975#discussion_r83308572
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/AllWindowedStream.scala
---
    @@ -361,38 +361,84 @@ class AllWindowedStream[T, W <: Window](javaStream: JavaAllWStream[T,
W]) {
     
       /**
        * Applies an aggregation that that gives the maximum element of the window by
    -   * the given position. When equality, returns the first.
    +   * the given position. When equality, returns the first by default.
        */
       def maxBy(position: Int): DataStream[T] = aggregate(AggregationType.MAXBY,
    -    position)
    +    position, true)
     
       /**
        * Applies an aggregation that that gives the maximum element of the window by
    -   * the given field. When equality, returns the first.
    +   * the given position. When equality, returns either the first or last one depending
    +   * on the parameter setting.
    +   */
    +  def maxBy(position: Int, first: Boolean): DataStream[T] = aggregate(AggregationType.MAXBY,
    +    position, first)
    +
    +  /**
    +   * Applies an aggregation that that gives the maximum element of the window by
    +   * the given field. When equality, returns the first by default.
        */
       def maxBy(field: String): DataStream[T] = aggregate(AggregationType.MAXBY,
    -    field)
    +    field, true)
    +
    +  /**
    +   * Applies an aggregation that that gives the maximum element of the window by
    +   * the given field. When equality, returns either the first or last one depending
    +   * on the parameter setting.
    +   */
    +  def maxBy(field: String, first: Boolean): DataStream[T] = aggregate(AggregationType.MAXBY,
    +    field, first)
     
       /**
        * Applies an aggregation that that gives the minimum element of the window by
    -   * the given position. When equality, returns the first.
    +   * the given position. When equality, returns the first by default.
        */
       def minBy(position: Int): DataStream[T] = aggregate(AggregationType.MINBY,
    -    position)
    +    position, true)
     
       /**
    -   * Applies an aggregation that that gives the minimum element of the window by
    -   * the given field. When equality, returns the first.
    +   * Applies an aggregation that that gives the maximum element of the window by
    +   * the given position. When equality, returns either the first or last one depending
    +   * on the parameter setting.
    +   */
    +  def minBy(position: Int, first: Boolean): DataStream[T] = aggregate(AggregationType.MINBY,
    +    position, first)
    +
    +  /**
    +   * Applies an aggregation that that gives the maximum element of the window by
    +   * the given field. When equality, returns the first by default.
        */
       def minBy(field: String): DataStream[T] = aggregate(AggregationType.MINBY,
    -    field)
    +    field, true)
    +
    +  /**
    +   * Applies an aggregation that that gives the maximum element of the window by
    +   * the given field. When equality, returns either the first or last one depending
    +   * on the parameter setting.
    +   */
    +  def minBy(field: String, first: Boolean): DataStream[T] = aggregate(AggregationType.MINBY,
    +    field, first)
    +
    +  private def aggregate(aggregationType: AggregationType, position: Int): DataStream[T]
= {
    --- End diff --
    
    This method may not be `private`. All public method of this class are declared stable
`@Public` and may not be changed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message