You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by zentol <gi...@git.apache.org> on 2017/05/03 16:01:15 UTC

[GitHub] flink pull request #3816: [FLINK-5720] Deprecate DataStream#fold()

GitHub user zentol opened a pull request:

    https://github.com/apache/flink/pull/3816

    [FLINK-5720] Deprecate DataStream#fold()

    This PR deprecates the various `DataStream#fold()` methods and all related internal classes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zentol/flink 5720_deprecate_folding

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/3816.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3816
    
----
commit 40fd483992f7820f8e6f7b26cd7e95a6d5f71507
Author: zentol <ch...@apache.org>
Date:   2017-05-03T13:49:03Z

    [FLINK-5720] Deprecate DataStream#fold()

----


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    merging.


---
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.
---

[GitHub] flink pull request #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3816#discussion_r114751208
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala ---
    @@ -183,7 +183,10 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T]
        * Creates a new [[DataStream]] by folding the elements of this DataStream
        * using an associative fold function and an initial value. An independent 
        * aggregate is kept per key.
    +   *
    +   * @deprecated will be removed in a future version
        */
    +  @Deprecated
    --- End diff --
    
    Do you propose to only have the reason in the annotation, or in both annotation and docs?


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by caddac <gi...@git.apache.org>.
Github user caddac commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    Sorry for commenting on this closed PR, but can you point me to documentation for what will replace fold? I'm starting a new project using 1.3 and don't want to use a deprecated API, but don't find much on what I should be replacing fold with.  Thanks


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by fhueske <gi...@git.apache.org>.
Github user fhueske commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    Hi @iduanyingjie, the replacement for fold has not been implemented yet. So you have to stick with `fold()` for now.
    
    `fold`'s replacement will correspond to `WindowedStream.aggregate(AggregateFunction)`.


---

[GitHub] flink pull request #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/flink/pull/3816


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    Cool, thanks for working on this (and the fold PR): 👍 


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    Man that stuff is everywhere isn't it...


---
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.
---

[GitHub] flink pull request #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3816#discussion_r114764971
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala ---
    @@ -183,7 +183,10 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T]
        * Creates a new [[DataStream]] by folding the elements of this DataStream
        * using an associative fold function and an initial value. An independent 
        * aggregate is kept per key.
    +   *
    +   * @deprecated will be removed in a future version
        */
    +  @Deprecated
    --- End diff --
    
    I've included them in the annotation.


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    I think we got them all now. I would have missed the one in `TypeExtractor`...
    
    LGTM (looks good to merge) now!


---
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.
---

[GitHub] flink pull request #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3816#discussion_r114756625
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala ---
    @@ -183,7 +183,10 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T]
        * Creates a new [[DataStream]] by folding the elements of this DataStream
        * using an associative fold function and an initial value. An independent 
        * aggregate is kept per key.
    +   *
    +   * @deprecated will be removed in a future version
        */
    +  @Deprecated
    --- End diff --
    
    I don't know, actually. It seems actual (random) code on GitHub only has it in the annotation: https://github.com/ReactiveX/RxScala/blob/0.x/src/main/scala/rx/lang/scala/Observable.scala#L4876


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by iduanyingjie <gi...@git.apache.org>.
Github user iduanyingjie commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    In this document
    [https://ci.apache.org/projects/flink/flink-docs-release-1.4/dev/stream/operators/index.html#datastream-transformations](url)
    `keyedStream.fold("start")((str, i) => { str + "-" + i })`
    I want to do the same thing, what am I supposed to do and and don't use deprecated API


---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by NicoK <gi...@git.apache.org>.
Github user NicoK commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    Actually, `KeyedStream.aggregate` is protected and thus not accessible.
    
    You may, however, access `WindowedStream#aggregate(AggregateFunction<T,ACC,R>) ` and `AllWindowedStream#aggregate(AggregateFunction<T,ACC,R>) ` for windowed streams and use a stateful map or flatmap for the rest.


---
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.
---

[GitHub] flink issue #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by wuchong <gi...@git.apache.org>.
Github user wuchong commented on the issue:

    https://github.com/apache/flink/pull/3816
  
    Hi @caddac ,  you can use `AggregateFunction` and `KeyedStream.aggregate(AggregationFunction<T> aggregate)` instead of fold. 


---
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.
---

[GitHub] flink pull request #3816: [FLINK-5720] Deprecate DataStream#fold()

Posted by aljoscha <gi...@git.apache.org>.
Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3816#discussion_r114743490
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/KeyedStream.scala ---
    @@ -183,7 +183,10 @@ class KeyedStream[T, K](javaStream: KeyedJavaStream[T, K]) extends DataStream[T]
        * Creates a new [[DataStream]] by folding the elements of this DataStream
        * using an associative fold function and an initial value. An independent 
        * aggregate is kept per key.
    +   *
    +   * @deprecated will be removed in a future version
        */
    +  @Deprecated
    --- End diff --
    
    Scala has `@deprecated` where you can also specify the reason right in the annotation. (https://coderwall.com/p/k4ulyg/scala-deprecated-annotation)
    
    Also holds for the other instances in Scala code.


---
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.
---