You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by kl0u <gi...@git.apache.org> on 2016/07/15 16:53:13 UTC

[GitHub] flink pull request #2259: [hotfix] Fixes broken TopSpeedWindowing scala exam...

GitHub user kl0u opened a pull request:

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

    [hotfix] Fixes broken TopSpeedWindowing scala example

    The problem was that in the case where no input file was provided, the `fromCollection()` source was never exiting and the actual program was never running. The new source is identical to the corresponding java test. 

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

    $ git pull https://github.com/kl0u/flink fix_example

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

    https://github.com/apache/flink/pull/2259.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 #2259
    
----
commit f235631596afaefc05c91f91fda05a7e301db661
Author: kl0u <kk...@gmail.com>
Date:   2016-07-15T16:20:04Z

    [hotfix] Fixes broken TopSpeedWindowing scala example

----


---
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 #2259: [hotfix] Fixes broken TopSpeedWindowing scala exam...

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

    https://github.com/apache/flink/pull/2259#discussion_r71155160
  
    --- Diff: flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/windowing/TopSpeedWindowing.scala ---
    @@ -72,7 +74,34 @@ object TopSpeedWindowing {
           } else {
             println("Executing TopSpeedWindowing example with default inputs data set.")
             println("Use --input to specify file input.")
    -        env.fromCollection(genCarStream())
    +        env.addSource(new SourceFunction[CarEvent]() {
    +
    +          val speeds = Array.fill[Integer](numOfCars)(50)
    +          val distances = Array.fill[Double](numOfCars)(0d)
    +          @Transient lazy val rand = new Random()
    +
    +          var counter = 0
    +          var isRunning:Boolean = true
    +
    +          override def run(ctx: SourceContext[CarEvent]) = {
    +            while (isRunning && counter < numOfEvents) {
    --- End diff --
    
    I think we shouldn't limit the number of emitted events. It is a streaming example and as such it should continuously run.


---
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 #2259: [hotfix] Fixes broken TopSpeedWindowing scala example

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

    https://github.com/apache/flink/pull/2259
  
    Good changes @kl0u. I only had a minor comment.


---
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 #2259: [hotfix] Fixes broken TopSpeedWindowing scala exam...

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

    https://github.com/apache/flink/pull/2259#discussion_r71155772
  
    --- Diff: flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/windowing/TopSpeedWindowing.scala ---
    @@ -72,7 +74,34 @@ object TopSpeedWindowing {
           } else {
             println("Executing TopSpeedWindowing example with default inputs data set.")
             println("Use --input to specify file input.")
    -        env.fromCollection(genCarStream())
    +        env.addSource(new SourceFunction[CarEvent]() {
    +
    +          val speeds = Array.fill[Integer](numOfCars)(50)
    +          val distances = Array.fill[Double](numOfCars)(0d)
    +          @Transient lazy val rand = new Random()
    +
    +          var counter = 0
    +          var isRunning:Boolean = true
    +
    +          override def run(ctx: SourceContext[CarEvent]) = {
    +            while (isRunning && counter < numOfEvents) {
    --- End diff --
    
    The reason for this is to be the same as the java TopSpeedWindowing example. 
    I suggest that if we change the one, we should also change the other too, as the user would expect the same behavior from both.
    
    What do you think?


---
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 #2259: [hotfix] Fixes broken TopSpeedWindowing scala exam...

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

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


---
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 #2259: [hotfix] Fixes broken TopSpeedWindowing scala example

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

    https://github.com/apache/flink/pull/2259
  
    @tillrohrmann  I integrated the comments. 
    Please review.


---
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 #2259: [hotfix] Fixes broken TopSpeedWindowing scala example

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

    https://github.com/apache/flink/pull/2259
  
    Changes look good to me. Thanks for your work @kl0u. Will merge this 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 pull request #2259: [hotfix] Fixes broken TopSpeedWindowing scala exam...

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

    https://github.com/apache/flink/pull/2259#discussion_r71156624
  
    --- Diff: flink-examples/flink-examples-streaming/src/main/scala/org/apache/flink/streaming/scala/examples/windowing/TopSpeedWindowing.scala ---
    @@ -72,7 +74,34 @@ object TopSpeedWindowing {
           } else {
             println("Executing TopSpeedWindowing example with default inputs data set.")
             println("Use --input to specify file input.")
    -        env.fromCollection(genCarStream())
    +        env.addSource(new SourceFunction[CarEvent]() {
    +
    +          val speeds = Array.fill[Integer](numOfCars)(50)
    +          val distances = Array.fill[Double](numOfCars)(0d)
    +          @Transient lazy val rand = new Random()
    +
    +          var counter = 0
    +          var isRunning:Boolean = true
    +
    +          override def run(ctx: SourceContext[CarEvent]) = {
    +            while (isRunning && counter < numOfEvents) {
    --- End diff --
    
    Yes you're right. Then let's also change the java example.


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