[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14626639#comment-14626639 ] ASF GitHub Bot commented on FLINK-2359: --- GitHub user ggevay opened a pull request: https://github.com/apache/flink/pull/911 [FLINK-2359] [java api] Add factory methods to the Java TupleX types I added the creation of the factory method to the TupleGenerator. I also fixed some inconsistencies between the generator and generated files: it seems that some modifications were made to generated files without modifying the generator. I incorporated these changes to the generator (see the first three hunks in the generator) (except for some whitespace changes in the first three modified files). I randomly changed some constructor calls into using the new method for testing and demonstration purposes (see the last two changed files). You can merge this pull request into a Git repository by running: $ git pull https://github.com/ggevay/flink tupleCreate Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/911.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 #911 commit 295f663e28116ffce24e9178359810c0a00290b0 Author: Gabor Gevay Date: 2015-07-14T16:34:05Z [FLINK-2359] [java api] Add factory methods to the Java TupleX types > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14626640#comment-14626640 ] Stephan Ewen commented on FLINK-2359: - >From 0.10 on, Flink requires at least Java 7. That means, you can use the >"diamond" to have the compiler infer generic parameters. But the change is probably reasonable, we could add that. > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14626676#comment-14626676 ] Gabor Gevay commented on FLINK-2359: Oh, I didn't know about the diamond thing, thanks! > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627574#comment-14627574 ] ASF GitHub Bot commented on FLINK-2359: --- Github user aljoscha commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121498601 Should we call it `of` instead of `create`? In other parts, such as the windowing helpers we also have `of` for these shortcut constructors. > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627601#comment-14627601 ] ASF GitHub Bot commented on FLINK-2359: --- Github user mbalassi commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121503903 I also prefer `of` as a method name. > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627741#comment-14627741 ] ASF GitHub Bot commented on FLINK-2359: --- Github user mxm commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121534658 Thanks for adding the generator methods. That's definitely more convenient than using `new`. I also prefer `of` instead of `create`. > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627743#comment-14627743 ] ASF GitHub Bot commented on FLINK-2359: --- Github user ggevay commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121535037 Ok, of looks better indeed. I will modify it. > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14627825#comment-14627825 ] ASF GitHub Bot commented on FLINK-2359: --- Github user fhueske commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121560503 PR looks good to me except for the purely reformatting changes which should be excluded from the PR. Thanks! > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14628131#comment-14628131 ] ASF GitHub Bot commented on FLINK-2359: --- Github user ggevay commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121633275 @fhueske: I included the reformatting changes because the generator is making them. This is happening because some modifications were made directly to some generated codes in the past, which made them inconsistent with the generator. But I guess the goal should be that the generator program would have no effect on the master. One way to achieve this is to commit the changes the generator makes, and the other way would be to change the generator to follow the reformatting. Do you think that I should change the PR to the latter with respect to the reformattings as well? (I already did the latter with respect to some real changes, see my opening comment.) > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14628138#comment-14628138 ] ASF GitHub Bot commented on FLINK-2359: --- Github user fhueske commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-121635133 Ah OK. Its fine to commit the changes if they are caused by the TupleGenerator. I don't think it's necessary to adapt the generator to avoid the changes. > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14631266#comment-14631266 ] ASF GitHub Bot commented on FLINK-2359: --- Github user fhueske commented on the pull request: https://github.com/apache/flink/pull/911#issuecomment-122264509 I'm going to merge this PR > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14631328#comment-14631328 ] ASF GitHub Bot commented on FLINK-2359: --- Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/911 > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2359) Add factory methods to the Java TupleX types
[ https://issues.apache.org/jira/browse/FLINK-2359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14631386#comment-14631386 ] Gabor Gevay commented on FLINK-2359: You're welcome! > Add factory methods to the Java TupleX types > > > Key: FLINK-2359 > URL: https://issues.apache.org/jira/browse/FLINK-2359 > Project: Flink > Issue Type: Improvement > Components: Java API >Affects Versions: 0.10 >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > Fix For: 0.10 > > > The compiler doesn't infer generic type arguments from constructor arguments, > which means that we have to call Tuple constructors like this: > Tuple2 = new Tuple2(5, "foo"); > I propose adding a factory method, which would provide the following > alternative: > Tuple2 = Tuple2.create(5, "foo"); > (Note that C++ and C# Tuples also have similar factory methods for the same > reason.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)