[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15442326#comment-15442326 ] ASF GitHub Bot commented on FLINK-4440: --- Github user mushketyk commented on the issue: https://github.com/apache/flink/pull/2398 Closing according to discussion in JIRA. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15442325#comment-15442325 ] ASF GitHub Bot commented on FLINK-4440: --- Github user mushketyk closed the pull request at: https://github.com/apache/flink/pull/2398 > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15439188#comment-15439188 ] Ivan Mushketyk commented on FLINK-4440: --- It's ok with me. I'll close the JIRA issue and the PR. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15439178#comment-15439178 ] Vasia Kalavri commented on FLINK-4440: -- Alright, makes sense. Let's close this then. Is that fine with you [~ivan.mushketyk] or is there anything we're overlooking here? > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15437533#comment-15437533 ] Greg Hogan commented on FLINK-4440: --- I think it is good to be explicit when assigning the vertex and edge values. By adding a second (and third?) means of creating a vertex simply adds to a user's cognitive load. The cost is small but I think the benefit is very small. More importantly, we should strive to solve the underlying problem of requiring one but only one value. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15437307#comment-15437307 ] Vasia Kalavri commented on FLINK-4440: -- I don't have a strong opinion against adding the {{create}} methods. Why do you think there is a cost to adding them [~greghogan]? > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434938#comment-15434938 ] Greg Hogan commented on FLINK-4440: --- The referenced code from {{Graph}} could also use the diamond operator (as noted by IntelliJ): {code} out.collect(new Vertex<>(edge.f0, NullValue.getInstance())); out.collect(new Vertex<>(edge.f1, NullValue.getInstance())); {code} There are four uses of {{NullValue.getInstance()}} in {{Graph}}. The tests (({{HITSData}}, {{TriangleCountData}}, and {{LabelPropagationData}}) could be made to loop over an array to create the vertex and edge sets (as in {{AsmTestBase}} so as to only reference {{NullValue.getInstance()}} once. There is a cost to having a separate {{create}} method for constructing these classes. The current form is more verbose but also very clear. I expect most users to read input from sources such as {{GraphCsvReader}} which hide the assignment of {{NullValue}}. [~vkalavri] worked to build the {{Graph}} API and it would be good to hear her opinion. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15433851#comment-15433851 ] Ivan Mushketyk commented on FLINK-4440: --- I assume that it will be used for instantiating in test cases, and in library code as well. For example Graph class contains the following code: {code:java} out.collect(new Vertex(edge.f0, NullValue.getInstance())); out.collect(new Vertex(edge.f1, NullValue.getInstance())); {code} which can be rewritten as: {code:java} out.collect(Vertex.create(edge.f0)); out.collect(Vertex.create(edge.f1)); {code} and this is not the only example. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15432718#comment-15432718 ] Greg Hogan commented on FLINK-4440: --- Yes, I stand corrected. When would these new methods be used? When instantiating multiple vertices or edges, as in test cases, I find it simpler to use a loop. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15431625#comment-15431625 ] Ivan Mushketyk commented on FLINK-4440: --- [~greghogan] On the second thought, We can define a static function in a following way: {code:java} public static Vertex create(K id) { return new Vertex<>(id, NullValue.getInstance()); } {code} guaranteeing that value type is NullValue, but we cannot define a constructor in a similar fashion. We can cast NullValue.getInstance() to value type like: {code:java} public Vertex(K id) { super(id, (V) NullValue.getInstance()); } {code} but then a user can write code like: {code:java} Vertex vertex = new Vertex<>(1); String str = vertex.getValue(); // ClassCastException {code} While similar code with a static function would not even compile {code:java} Vertex vertex = Vertex.create(1); // compilation error {code} > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15430534#comment-15430534 ] Ivan Mushketyk commented on FLINK-4440: --- Hi [~greg hogan], I think you have a good point. I'll update my PR today. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429953#comment-15429953 ] Greg Hogan commented on FLINK-4440: --- Flink supports a minimum of Java 7 (which is end-of-life) so the current usage with the diamond operator is {{Vertex v = new Vertex<>(42, NullValue.getInstance());}}. If we were to add these I think having a second constructor without the value parameter would be clearer than creating two new static methods. I think the better long-term solution would be to have Vertex and Edge be interfaces or abstract classes to use POJOs instead of tuples. > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429794#comment-15429794 ] ASF GitHub Bot commented on FLINK-4440: --- Github user mushketyk commented on the issue: https://github.com/apache/flink/pull/2398 Hi @vasia I've created a JIRA issue for the pull request. What do you think about this change? > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-4440) Make API for edge/vertex creation less verbose
[ https://issues.apache.org/jira/browse/FLINK-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15429793#comment-15429793 ] Ivan Mushketyk commented on FLINK-4440: --- Pull request: https://github.com/apache/flink/pull/2398 > Make API for edge/vertex creation less verbose > -- > > Key: FLINK-4440 > URL: https://issues.apache.org/jira/browse/FLINK-4440 > Project: Flink > Issue Type: Improvement > Components: Gelly >Reporter: Ivan Mushketyk >Assignee: Ivan Mushketyk >Priority: Trivial > > It would be better if one could create vertex/edges like this: > {code:java} > Vertex v = Vertex.create(42); > Edge e = Edge.create(5, 6); > {code} > Instead of this: > {code:java} > Vertex v = new Vertex(42, > NullValue.getInstance()); > Edge e = new Edge NullValue>(5, 6, NullValue.getInstance()); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)