[GitHub] [tinkerpop] spmallette opened a new pull request #1240: TINKERPOP-2312 Empty keys to group() should group to null
spmallette opened a new pull request #1240: TINKERPOP-2312 Empty keys to group() should group to null URL: https://github.com/apache/tinkerpop/pull/1240 https://issues.apache.org/jira/browse/TINKERPOP-2312 Basically, this: ```text gremlin> g.V().group().by('age') The property does not exist as the key has no associated value for the provided element: v[3]:age Type ':help' or ':h' for help. Display stack trace? [yN]n ``` now does this: ```text gremlin> g.V().groupCount().by('age') ==>[null:2,32:1,35:1,27:1,29:1] ``` which has its conveniences but also produces a result that would be easier to follow for new users as opposed to the old exception. All tests pass with `docker/build.sh -t -n -i` VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[tinkerpop] 01/01: TINKERPOP-2312 Empty keys to group() should group to null
This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-2312 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 358605363f68d0d18332973518abf94ae3d0a93c Author: stephen AuthorDate: Thu Jan 16 11:23:06 2020 -0500 TINKERPOP-2312 Empty keys to group() should group to null --- docs/src/reference/gremlin-variants.asciidoc | 58 ++ docs/src/upgrade/release-3.5.x.asciidoc| 21 ...mentValueTraversal.java => ValueTraversal.java} | 26 ++--- .../process/traversal/step/ByModulating.java | 6 +- .../process/traversal/step/PathProcessor.java | 4 +- .../process/traversal/step/map/GroupStep.java | 4 +- .../strategy/decoration/SubgraphStrategy.java | 8 +- .../process/traversal/util/TraversalHelper.java| 4 +- .../lambda/ElementValueTraversalTest.java | 78 -- .../traversal/lambda/ValueTraversalTest.java | 118 + .../optimization/PathProcessorStrategyTest.java| 14 +-- .../Gherkin/GherkinTestRunner.cs | 1 + .../Gherkin/IgnoreException.cs | 9 +- .../Gherkin/ScenarioData.cs| 6 +- .../test/cucumber/feature-steps.js | 2 + gremlin-test/features/sideEffect/Group.feature | 11 ++ .../traversal/step/sideEffect/GroupTest.java | 27 - 17 files changed, 275 insertions(+), 122 deletions(-) diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc index 74a58f7..5898050 100644 --- a/docs/src/reference/gremlin-variants.asciidoc +++ b/docs/src/reference/gremlin-variants.asciidoc @@ -1135,6 +1135,28 @@ and then it can be called from the application as follows: include::../../../gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Docs/Reference/GremlinVariantsDslTests.cs[tags=dslExamples] +[[gremlin-dotnet-differences]] +=== Differences + +Gremlin allows for `Map` instances to include `null` keys, but `null` keys in C# `Dictionary` instances are not allowed. +It is therefore necessary to rewrite a traversal such as: + +[source,javascript] + +g.V().groupCount().by('age') + + +where "age" is not a valid key for all vertices in a way that will remove the need for a `null` to be returned. + +[source,javascript] + +g.V().has('age').groupCount().by('age') +g.V().hasLabel('person').groupCount().by('age') + + +Either of the above two options accomplishes the desired goal as both prevent `groupCount()` from having to process +the possibility of `null`. + anchor:gremlin-dotnet-template[] [[dotnet-application-examples]] === Application Examples @@ -1323,3 +1345,39 @@ In situations where Javascript reserved words and global functions overlap with bits of conflicting Gremlin get an underscore appended as a suffix: *Steps* - <>, <>, <> + +Gremlin allows for `Map` instances to include `null` keys, but `null` keys in Javascript have some interesting behavior +as in: + +[source,text] + +> var a = { null: 'something', 'b': 'else' }; +> JSON.stringify(a) +'{"null":"something","b":"else"}' +> JSON.parse(JSON.stringify(a)) +{ null: 'something', b: 'else' } +> a[null] +'something' +> a['null'] +'something' + + +This behavior needs to be considered when using Gremlin to return such results. A typical situation where this might +happen is with `group()` or `groupCount()` as in: + +[source,javascript] + +g.V().groupCount().by('age') + + +where "age" is not a valid key for all vertices. In these cases, it will return `null` for that key and group on that. +It may bet better in Javascript to filter away those vertices to avoid the return of `null` in the returned `Map`: + +[source,javascript] + +g.V().has('age').groupCount().by('age') +g.V().hasLabel('person').groupCount().by('age') + + +Either of the above two options accomplishes the desired goal as both prevent `groupCount()` from having to process +the possibility of `null`. \ No newline at end of file diff --git a/docs/src/upgrade/release-3.5.x.asciidoc b/docs/src/upgrade/release-3.5.x.asciidoc index db1426f..08b4ec2 100644 --- a/docs/src/upgrade/release-3.5.x.asciidoc +++ b/docs/src/upgrade/release-3.5.x.asciidoc @@ -164,6 +164,27 @@ gremlin> g.V().has('person','age',null) ==>v[13] +The above described changes also has an effect on steps like `group()` and `groupCount()` which formerly produced +exceptions when keys could not be found: + +[source,text] + +gremlin> g.V().group().by('age') +The property does not exist as the key has no associated value for the provided element: v[3]:age +Type ':help' or ':h' for help. +Display stack trace? [yN]n + + +The solution was to filter away vertices that did not have the available key so that such steps would work properly +or to write a more complex `by()` modulator to better handle the possibility of a missing key. With the
[tinkerpop] branch TINKERPOP-2312 created (now 3586053)
This is an automated email from the ASF dual-hosted git repository. spmallette pushed a change to branch TINKERPOP-2312 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git. at 3586053 TINKERPOP-2312 Empty keys to group() should group to null This branch includes the following new commits: new 3586053 TINKERPOP-2312 Empty keys to group() should group to null The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[GitHub] [tinkerpop] jorgebay commented on issue #1239: TINKERPOP-2329 JavaScript GLV: upgrade ws dependency
jorgebay commented on issue #1239: TINKERPOP-2329 JavaScript GLV: upgrade ws dependency URL: https://github.com/apache/tinkerpop/pull/1239#issuecomment-575196786 Also, I wanted to start a thread on the mailing list to discuss runtime version support policy (for Node.js but could apply to techs), I hope I have time in the next couple of days to do it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [tinkerpop] jorgebay opened a new pull request #1239: TINKERPOP-2329 JavaScript GLV: upgrade ws dependency
jorgebay opened a new pull request #1239: TINKERPOP-2329 JavaScript GLV: upgrade ws dependency URL: https://github.com/apache/tinkerpop/pull/1239 Update dependencies as long as those work with Node.js 6+ runtime. https://issues.apache.org/jira/browse/TINKERPOP-2329 VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[tinkerpop] branch TINKERPOP-2329 updated: TINKERPOP-2329 Update all dev dependencies
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2329 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/TINKERPOP-2329 by this push: new 640297e TINKERPOP-2329 Update all dev dependencies 640297e is described below commit 640297ed58279ca73f8456f539d92c676c62e2ed Author: Jorge Bay Gondra AuthorDate: Thu Jan 16 15:28:15 2020 +0100 TINKERPOP-2329 Update all dev dependencies --- gremlin-javascript/glv/PackageJson.template| 10 +- .../src/main/javascript/gremlin-javascript/package.json| 10 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template index a40d3f7..4089dc2 100644 --- a/gremlin-javascript/glv/PackageJson.template +++ b/gremlin-javascript/glv/PackageJson.template @@ -38,10 +38,10 @@ "devDependencies": { "chai": "~4.1.2", "cucumber": "~4.2.1", -"grunt": "~1.0.2", -"grunt-cli": "~1.2.0", -"grunt-jsdoc": "~2.3.0", -"mocha": "~4.0.1" +"grunt": "~1.0.4", +"grunt-cli": "~1.3.2", +"grunt-jsdoc": "~2.3.1", +"mocha": "~5.2.0" }, "repository": { "type": "git", @@ -53,7 +53,7 @@ }, "scripts": { "test": "./node_modules/mocha/bin/mocha test/unit test/integration -t 5000", -"features": "cucumber.js --require test/cucumber ../../../../../gremlin-test/features/", +"features": "./node_modules/.bin/cucumber-js --require test/cucumber ../../../../../gremlin-test/features/", "unit-test": "./node_modules/mocha/bin/mocha test/unit" }, "engines": { diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json index ff36cbd..6485f9b 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json @@ -19,10 +19,10 @@ "devDependencies": { "chai": "~4.1.2", "cucumber": "~4.2.1", -"grunt": "~1.0.2", -"grunt-cli": "~1.2.0", -"grunt-jsdoc": "~2.3.0", -"mocha": "~4.0.1" +"grunt": "~1.0.4", +"grunt-cli": "~1.3.2", +"grunt-jsdoc": "~2.3.1", +"mocha": "~5.2.0" }, "repository": { "type": "git", @@ -34,7 +34,7 @@ }, "scripts": { "test": "./node_modules/mocha/bin/mocha test/unit test/integration -t 5000", -"features": "cucumber.js --require test/cucumber ../../../../../gremlin-test/features/", +"features": "./node_modules/.bin/cucumber-js --require test/cucumber ../../../../../gremlin-test/features/", "unit-test": "./node_modules/mocha/bin/mocha test/unit" }, "engines": {
[tinkerpop] 01/01: TINKERPOP-2329 JavaScript GLV: upgrade ws dependency
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2329 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 4a1e9b99c51706f032a31592ed98a2ae2ec93c48 Author: Jorge Bay Gondra AuthorDate: Thu Jan 16 14:13:29 2020 +0100 TINKERPOP-2329 JavaScript GLV: upgrade ws dependency --- gremlin-javascript/glv/PackageJson.template | 12 ++-- .../src/main/javascript/gremlin-javascript/package.json | 12 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gremlin-javascript/glv/PackageJson.template b/gremlin-javascript/glv/PackageJson.template index 8bc2905..a40d3f7 100644 --- a/gremlin-javascript/glv/PackageJson.template +++ b/gremlin-javascript/glv/PackageJson.template @@ -33,15 +33,15 @@ ], "license": "Apache-2.0", "dependencies": { -"ws": "^3.0.0" +"ws": "^6.2.1" }, "devDependencies": { -"mocha": "~4.0.1", -"cucumber": "~3.1.0", "chai": "~4.1.2", +"cucumber": "~4.2.1", "grunt": "~1.0.2", "grunt-cli": "~1.2.0", -"grunt-jsdoc": "~2.3.0" +"grunt-jsdoc": "~2.3.0", +"mocha": "~4.0.1" }, "repository": { "type": "git", @@ -52,9 +52,9 @@ "url": "https://issues.apache.org/jira/browse/TINKERPOP; }, "scripts": { -"test": "mocha test/unit test/integration -t 5000", +"test": "./node_modules/mocha/bin/mocha test/unit test/integration -t 5000", "features": "cucumber.js --require test/cucumber ../../../../../gremlin-test/features/", -"unit-test": "mocha test/unit" +"unit-test": "./node_modules/mocha/bin/mocha test/unit" }, "engines": { "node": ">=6" diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json index 9aa5a2b..ff36cbd 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package.json @@ -14,15 +14,15 @@ ], "license": "Apache-2.0", "dependencies": { -"ws": "^3.0.0" +"ws": "^6.2.1" }, "devDependencies": { -"mocha": "~4.0.1", -"cucumber": "~3.1.0", "chai": "~4.1.2", +"cucumber": "~4.2.1", "grunt": "~1.0.2", "grunt-cli": "~1.2.0", -"grunt-jsdoc": "~2.3.0" +"grunt-jsdoc": "~2.3.0", +"mocha": "~4.0.1" }, "repository": { "type": "git", @@ -33,9 +33,9 @@ "url": "https://issues.apache.org/jira/browse/TINKERPOP; }, "scripts": { -"test": "mocha test/unit test/integration -t 5000", +"test": "./node_modules/mocha/bin/mocha test/unit test/integration -t 5000", "features": "cucumber.js --require test/cucumber ../../../../../gremlin-test/features/", -"unit-test": "mocha test/unit" +"unit-test": "./node_modules/mocha/bin/mocha test/unit" }, "engines": { "node": ">=6"
[tinkerpop] branch TINKERPOP-2329 created (now 4a1e9b9)
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a change to branch TINKERPOP-2329 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git. at 4a1e9b9 TINKERPOP-2329 JavaScript GLV: upgrade ws dependency This branch includes the following new commits: new 4a1e9b9 TINKERPOP-2329 JavaScript GLV: upgrade ws dependency The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.