You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by FlorianHockmann <gi...@git.apache.org> on 2018/01/13 18:20:25 UTC

[GitHub] tinkerpop pull request #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to ...

GitHub user FlorianHockmann opened a pull request:

    https://github.com/apache/tinkerpop/pull/776

    TINKERPOP-1868 Gremlin.Net: Add Inject step to GraphTraversalSource

    https://issues.apache.org/jira/browse/TINKERPOP-1868
    
    This adds the `Inject` step to `GraphTraversalSource` for Gremlin.Net. While working on this I also noticed that the interface wasn't optimal for the existing `GraphTraversal` `Inject` step as it accepted a `params object[] injections` although it should only except `injections` of the generic type `E`. So I also fixed that.
    
    Method signature before:
    ```
    public GraphTraversal< S , E > Inject (params object[] injections)
    ```
    and after:
    ```
    public GraphTraversal< S , E > Inject (params E[] injections)
    ```
    
    Now, a traversal like the following isn't possible any more in Gremlin.Net:
    ```
    g.V().Values<string>("name").Inject(1).ToList();
    ```
    as `Inject` now only accepts strings here (just like Gremlin-Java does).

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

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1868

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

    https://github.com/apache/tinkerpop/pull/776.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 #776
    
----
commit 1b13f052629170097e303680e1a0da5fd9e2bfac
Author: florianhockmann <fh...@...>
Date:   2018-01-12T17:13:45Z

    Add GraphTraversalSource.Inject TINKERPOP-1868

commit 944c2c8711db585f1ce17fd382ecfb96c4a87bc3
Author: florianhockmann <fh...@...>
Date:   2018-01-13T18:05:03Z

    Make Injects signature type-safe TINKERPOP-1868

----


---

[GitHub] tinkerpop issue #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to GraphTr...

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

    https://github.com/apache/tinkerpop/pull/776
  
    ah - ok. i get what is happening now. thanks for clarifying. in that case:
    
    VOTE +1


---

[GitHub] tinkerpop pull request #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to ...

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

    https://github.com/apache/tinkerpop/pull/776#discussion_r162380860
  
    --- Diff: gremlin-dotnet/glv/GraphTraversal.template ---
    @@ -68,7 +68,7 @@ namespace Gremlin.Net.Process.Traversal
             public GraphTraversal< <%= method.t1 %> , <%= method.t2 %> > <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %> (<%= method.parameters %>)
             {
             <%  if (method.parameters.contains("params ")) {
    -      %>    var args = new List<object>(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    +      %>    var args = new List< <%= method.argsListType %> >(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    --- End diff --
    
    +1


---

[GitHub] tinkerpop issue #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to GraphTr...

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

    https://github.com/apache/tinkerpop/pull/776
  
    If this is a breaking change for .NET users in some way, it would be good to write something in the upgrade documentation about it.  A changelog entry would also be good (either way). 


---

[GitHub] tinkerpop issue #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to GraphTr...

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

    https://github.com/apache/tinkerpop/pull/776
  
    ```
    $ docker/build.sh -t -i
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] Apache TinkerPop .................................. SUCCESS [1:14.896s]
    [INFO] Apache TinkerPop :: Gremlin Shaded ................ SUCCESS [17.284s]
    [INFO] Apache TinkerPop :: Gremlin Core .................. SUCCESS [1:00.729s]
    [INFO] Apache TinkerPop :: Gremlin Test .................. SUCCESS [8.073s]
    [INFO] Apache TinkerPop :: Gremlin Groovy ................ SUCCESS [2:33.551s]
    [INFO] Apache TinkerPop :: Gremlin Groovy Test ........... SUCCESS [5.123s]
    [INFO] Apache TinkerPop :: TinkerGraph Gremlin ........... SUCCESS [3:54.724s]
    [INFO] Apache TinkerPop :: Gremlin Benchmark ............. SUCCESS [6.655s]
    [INFO] Apache TinkerPop :: Gremlin Driver ................ SUCCESS [1:15.868s]
    [INFO] Apache TinkerPop :: Neo4j Gremlin ................. SUCCESS [1.776s]
    [INFO] Apache TinkerPop :: Gremlin Server ................ SUCCESS [9:36:46.546s]
    [INFO] Apache TinkerPop :: Gremlin Python ................ SUCCESS [1:38.416s]
    [INFO] Apache TinkerPop :: Gremlin.Net ................... SUCCESS [2.961s]
    [INFO] Apache TinkerPop :: Gremlin.Net - Source .......... SUCCESS [58.269s]
    [INFO] Apache TinkerPop :: Gremlin.Net - Tests ........... SUCCESS [52.578s]
    [INFO] Apache TinkerPop :: Hadoop Gremlin ................ SUCCESS [8:02.139s]
    [INFO] Apache TinkerPop :: Spark Gremlin ................. SUCCESS [17:15.718s]
    [INFO] Apache TinkerPop :: Giraph Gremlin ................ SUCCESS [3:16:25.204s]
    [INFO] Apache TinkerPop :: Gremlin Console ............... SUCCESS [4:09.178s]
    [INFO] Apache TinkerPop :: Gremlin Archetype ............. SUCCESS [0.261s]
    [INFO] Apache TinkerPop :: Archetype - TinkerGraph ....... SUCCESS [25.908s]
    [INFO] Apache TinkerPop :: Archetype - Server ............ SUCCESS [15.679s]
    [INFO] Apache TinkerPop :: Archetype - DSL ............... SUCCESS [4.216s]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 13:37:42.997s
    [INFO] Finished at: Sun Jan 14 12:37:29 UTC 2018
    [INFO] Final Memory: 169M/552M
    [INFO] ------------------------------------------------------------------------
    ```
    VOTE: +1


---

[GitHub] tinkerpop issue #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to GraphTr...

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

    https://github.com/apache/tinkerpop/pull/776
  
    Looks great, I've added comment / question above but its just a nit.
    
    VOTE +1


---

[GitHub] tinkerpop pull request #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to ...

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

    https://github.com/apache/tinkerpop/pull/776


---

[GitHub] tinkerpop pull request #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to ...

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

    https://github.com/apache/tinkerpop/pull/776#discussion_r162555342
  
    --- Diff: gremlin-dotnet/glv/GraphTraversal.template ---
    @@ -68,7 +68,7 @@ namespace Gremlin.Net.Process.Traversal
             public GraphTraversal< <%= method.t1 %> , <%= method.t2 %> > <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %> (<%= method.parameters %>)
             {
             <%  if (method.parameters.contains("params ")) {
    -      %>    var args = new List<object>(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    +      %>    var args = new List< <%= method.argsListType %> >(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    --- End diff --
    
    Wow, nice!
    I've reviewed the end result and looks good.


---

[GitHub] tinkerpop pull request #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to ...

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

    https://github.com/apache/tinkerpop/pull/776#discussion_r162432862
  
    --- Diff: gremlin-dotnet/glv/GraphTraversal.template ---
    @@ -68,7 +68,7 @@ namespace Gremlin.Net.Process.Traversal
             public GraphTraversal< <%= method.t1 %> , <%= method.t2 %> > <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %> (<%= method.parameters %>)
             {
             <%  if (method.parameters.contains("params ")) {
    -      %>    var args = new List<object>(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    +      %>    var args = new List< <%= method.argsListType %> >(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    --- End diff --
    
    Agree, those spaces shouldn't be there and I just found a way to remove them: Variables can be used in a Groovy template in the form of `$variable` which avoids the problem with the double `<` as `<<%= variable %>>` doesn't work.
    I pushed a commit that should remove all those unnecessary spaces from the generated classes in Gremlin.Net (at least I hope that I got all).


---

[GitHub] tinkerpop issue #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to GraphTr...

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

    https://github.com/apache/tinkerpop/pull/776
  
    I don't think that it is a breaking change as it only prevents users from sending traversals with invalid arguments for the `inject` step to the server which should cause a runtime error on the server side at the moment. With this change, this runtime error would now be a compile time error.


---

[GitHub] tinkerpop pull request #776: TINKERPOP-1868 Gremlin.Net: Add Inject step to ...

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

    https://github.com/apache/tinkerpop/pull/776#discussion_r162377440
  
    --- Diff: gremlin-dotnet/glv/GraphTraversal.template ---
    @@ -68,7 +68,7 @@ namespace Gremlin.Net.Process.Traversal
             public GraphTraversal< <%= method.t1 %> , <%= method.t2 %> > <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %> (<%= method.parameters %>)
             {
             <%  if (method.parameters.contains("params ")) {
    -      %>    var args = new List<object>(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    +      %>    var args = new List< <%= method.argsListType %> >(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
    --- End diff --
    
    Can we do something about the extra spacing?


---