GitHub user okram opened a pull request:
https://github.com/apache/incubator-tinkerpop/pull/318
TINKERPOP-1307: NPE with OLTP nested group() in an OLAP group() traversal
https://issues.apache.org/jira/browse/TINKERPOP-1307
When an OLAP traversal has a `group()` that contains, nested another
`group()`, the latter `group()` is OLTP, but due to transient declarations, a
null pointer can arise. To rectify this, `GroupStep.GroupBiOperator` no longer
passes around `Traversal` and instead, 4 types: `Traverser`, `TraverserSet`,
`Pair<TraverserSet,Object`, `Object`, where `Object` is the current barrier of
an internal `Barrier`. Two complex nested group tests were added to demonstrate
that things function as expected and there are no longer NPEs.
This change made `group()` a bit slower, but not by much and now the code
is safer. For a play test I have, the OLTP speed (which is the important one)
went from 436ms to 456ms. Again, no biggie.
CHANGELOG
```
* Fixed a `NullPointerException` bug around nested `group()`-steps in OLAP.
```
`mvn clean install` and integration tests pass.
```
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache TinkerPop .................................. SUCCESS [4.643s]
[INFO] Apache TinkerPop :: Gremlin Shaded ................ SUCCESS [2.240s]
[INFO] Apache TinkerPop :: Gremlin Core .................. SUCCESS [36.764s]
[INFO] Apache TinkerPop :: Gremlin Test .................. SUCCESS [11.672s]
[INFO] Apache TinkerPop :: Gremlin Groovy ................ SUCCESS [39.749s]
[INFO] Apache TinkerPop :: Gremlin Groovy Test ........... SUCCESS [7.219s]
[INFO] Apache TinkerPop :: TinkerGraph Gremlin ........... SUCCESS
[3:24.052s]
[INFO] Apache TinkerPop :: Gremlin Benchmark ............. SUCCESS [4.156s]
[INFO] Apache TinkerPop :: Hadoop Gremlin ................ SUCCESS
[10:46.080s]
[INFO] Apache TinkerPop :: Spark Gremlin ................. SUCCESS
[6:40.139s]
[INFO] Apache TinkerPop :: Giraph Gremlin ................ SUCCESS
[2:48:03.627s]
[INFO] Apache TinkerPop :: Neo4j Gremlin ................. SUCCESS
[1:08:44.849s]
[INFO] Apache TinkerPop :: Gremlin Driver ................ SUCCESS [10.102s]
[INFO] Apache TinkerPop :: Gremlin Server ................ SUCCESS
[13:20.898s]
[INFO] Apache TinkerPop :: Gremlin Console ............... SUCCESS
[1:24.523s]
[INFO] Apache TinkerPop :: Gremlin Archetype ............. SUCCESS [0.133s]
[INFO] Apache TinkerPop :: Archetype - TinkerGraph ....... SUCCESS [5.907s]
[INFO] Apache TinkerPop :: Archetype - Server ............ SUCCESS [10.589s]
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 4:34:37.829s
[INFO] Finished at: Mon May 23 22:03:45 MDT 2016
[INFO] Final Memory: 99M/680M
[INFO]
------------------------------------------------------------------------
```
VOTE +1
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1307
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-tinkerpop/pull/318.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 #318
----
commit c890cebad5231cdab8744878bebb4ea363689a3a
Author: Marko A. Rodriguez <[email protected]>
Date: 2016-05-23T22:24:58Z
fixed the NPE that occurs in OLAP when you have a local/OLTP group() nested
within an OLAP group(). The solution is elegant, but the problem, its not as
efficient as the code when we had the NPE.... dar. Going to fiddle some more
tomorrow to see if I can get it faster --- 600ms vs 400ms differences.
commit e087123ca9bf513a555b3666a201905df43d8f7c
Author: Marko A. Rodriguez <[email protected]>
Date: 2016-05-23T23:26:35Z
came up with a nifty trick and now OLD and NEW group() are much closer in
time. 432ms vs 456ms. Given that the solution is no longer an NPE in nested
groups in OLAP -- this minor time hit is worth it. :). Running integration
tests over night.
commit 085be94691357db5615ed4281a978b686bce6898
Author: Marko A. Rodriguez <[email protected]>
Date: 2016-05-24T07:23:14Z
some code clean up/organization and added a more complex group() nesting
that requires an OLAP walk and an OLTP walk. Also found a bunch of HadoopGraph
tests that were needlessly being Opt_Out'd -- fixed.
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---