You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by ch33hau <gi...@git.apache.org> on 2017/06/24 14:44:48 UTC

[GitHub] flink pull request #4178: [FLINK-7000] Add custom configuration local enviro...

GitHub user ch33hau opened a pull request:

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

    [FLINK-7000] Add custom configuration local environment in Scala StreamExecutionEnvironment

    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [x] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    
    - [x] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [x] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed


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

    $ git pull https://github.com/ch33hau/flink custom-configuration-for-scala-stream-env

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

    https://github.com/apache/flink/pull/4178.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 #4178
    
----
commit 03059ede52f2b28b70a1f8f2161348368bc95225
Author: Lim Chee Hau <ch...@gmail.com>
Date:   2017-06-24T14:26:15Z

    [FLINK-7000] Add custom configuration local environment in Scala StreamExecutionEnvironment

----


---
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 #4178: [FLINK-7000] Add custom configuration local environment i...

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

    https://github.com/apache/flink/pull/4178
  
    Hi @zentol ,
    
    I have updated PR by adding a new method without default values.
    
    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 #4178: [FLINK-7000] Add custom configuration local environment i...

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

    https://github.com/apache/flink/pull/4178
  
    you're modifying an existing method, didn't you mean to _add_ a new one?


---
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 #4178: [FLINK-7000] Add custom configuration local environment i...

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

    https://github.com/apache/flink/pull/4178
  
    Thank you @zentol !


---
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 #4178: [FLINK-7000] Add custom configuration local environment i...

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

    https://github.com/apache/flink/pull/4178
  
    Hi @zentol , thanks for taking time for reviewing :)
    
    It was my original thought. 
    However turns out due to `Scala` supports `default value` in parameters, in order to achieve same behaviour as Java, adding a new method is not working here.
    
     This is what currently Java has:
    
        1. createLocalEnvironment()
        2. createLocalEnvironment(Int)
        3. createLocalEnvironment(Int, Configuration)
    
    Before this PR, in Scala we have:
    
        createLocalEnvironment(Int = defaultValue)
    
    So a Scala user can access this method by `createLocalEnvironment()` or `createLocalEnvironment(someValue)`.
    
    If I add another method `createLocalEnvironment(Int = defaultValue, conf = defaultValue)`, compiler will complain because at this moment `createLocalEnvironment(someValue)` is ambiguous.
    
    My opinion is by just adding a parameter with default value to existing method, it doesn't change the existing way to access the method. 
    
    How 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 #4178: [FLINK-7000] Add custom configuration local enviro...

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

    https://github.com/apache/flink/pull/4178#discussion_r123979379
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/StreamExecutionEnvironment.scala ---
    @@ -768,6 +768,18 @@ object StreamExecutionEnvironment {
       }
     
       /**
    +   * Creates a local execution environment. The local execution environment will run the
    +   * program in a multi-threaded fashion in the same JVM as the environment was created in.
    +   *
    +   * @param parallelism   The parallelism for the local environment.
    +   * @param configuration Pass a custom configuration into the cluster.
    +   */
    +  def createLocalEnvironment(parallelism: Int, configuration: Configuration):
    --- End diff --
    
    well that's unfortunate.


---
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 #4178: [FLINK-7000] Add custom configuration local enviro...

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

    https://github.com/apache/flink/pull/4178#discussion_r123906377
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/StreamExecutionEnvironment.scala ---
    @@ -768,6 +768,18 @@ object StreamExecutionEnvironment {
       }
     
       /**
    +   * Creates a local execution environment. The local execution environment will run the
    +   * program in a multi-threaded fashion in the same JVM as the environment was created in.
    +   *
    +   * @param parallelism   The parallelism for the local environment.
    +   * @param configuration Pass a custom configuration into the cluster.
    +   */
    +  def createLocalEnvironment(parallelism: Int, configuration: Configuration):
    --- End diff --
    
    can the parallelism have a default value?


---
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 #4178: [FLINK-7000] Add custom configuration local environment i...

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

    https://github.com/apache/flink/pull/4178
  
    Do you mean a new method with `createLocalEnvironment(Int, conf)`?
    
    By this way compiler won't complain, just both the value have to be entered. 
    However, I do agree that the way that you have suggested could allows user to pass in custom configuration without modifying public API
    
    I could update the PR in a moment.


---
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 #4178: [FLINK-7000] Add custom configuration local enviro...

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

    https://github.com/apache/flink/pull/4178#discussion_r123912353
  
    --- Diff: flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/StreamExecutionEnvironment.scala ---
    @@ -768,6 +768,18 @@ object StreamExecutionEnvironment {
       }
     
       /**
    +   * Creates a local execution environment. The local execution environment will run the
    +   * program in a multi-threaded fashion in the same JVM as the environment was created in.
    +   *
    +   * @param parallelism   The parallelism for the local environment.
    +   * @param configuration Pass a custom configuration into the cluster.
    +   */
    +  def createLocalEnvironment(parallelism: Int, configuration: Configuration):
    --- End diff --
    
    No it can't. I have think about it before, again compiler complains.
    
    It could be related to this [scala issue](https://stackoverflow.com/questions/4652095/why-does-the-scala-compiler-disallow-overloaded-methods-with-default-arguments)
    
        If you have two overloads with defaults on the same parameter position, 
        we would need a different naming scheme. 
        But we want to keep the generated byte-code stable over multiple compiler runs.


---
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 #4178: [FLINK-7000] Add custom configuration local environment i...

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

    https://github.com/apache/flink/pull/4178
  
    This method is part of the public API and thus must not be changed.
    
    Does the compiler still complain if there is no default value for the configuration?


---
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 #4178: [FLINK-7000] Add custom configuration local enviro...

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

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


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