steigma opened a new pull request, #2425: URL: https://github.com/apache/tinkerpop/pull/2425
Improved within test check for bulkset with elements (i.e., Vertex, Edge, VertexProperty) by using contains method. Due to changes w.r.t. Gremlin comparison semantics (cf. https://tinkerpop.apache.org/docs/3.7.0/dev/provider/#gremlin-semantics-concepts) this check was no longer done efficiently, which led to some regressions (see query/example below). In some cases, we can however ensure that the contains of the bulkset (using hash code and Object.equals) leads to the same results as the GremlinValueComparator.COMPARABILITY.equals. In fact, for elements, both checks are only be done with the ids of these elements. This change re-enables an efficient check for elements (if the bulkset also contains these elements and only contains these kind of elements). This is realized via a transient attribute (allContainedElementsSameClass) in the bulkset class that represents whether all elements are of same type/class, which is checked by the within test method. Tje attribute is computed lazily when accessed to avoid overhead if the information is not required. Pseudo code for sample data: ``` final Vertex x1 = G.addVertex(T.id, "x1", T.label, "person", "age", 27, "name", "x1"); // many friends for x1 for (int i = 1; i < 10000; ++i) { final Vertex x1fi = G.addVertex(T.id, "f"+i, T.label, "person", "age", 27, "name", "f"+i); x1.addEdge("knows", x1fi, T.id, "e-x1-f"+i, "weight", 0.5); } // one special friend that also has many other friends final Vertex x1f0 = G.addVertex(T.id, "f0", T.label, "person", "age", 27, "name", "f0"); x1.addEdge("knows", x1f0, T.id, "e-x1-f0", "weight", 0.5); // adding these many other friends, so friends of friends for x1 for (int i = 1; i < 10000; ++i) { final Vertex x1f0ofi = G.addVertex(T.id, "fof"+i, T.label, "person", "age", 27, "name", "fof"+i); x1f0.addEdge("knows", x1f0ofi, T.id, "e-f0-f"+i, "weight", 0.5); } ``` Sample query (which is very inefficiently executed without this change): ``` g.V("x1").as("root").aggregate("directFriends") .select("root").out().aggregate("directFriends") .select("directFriends").limit(1).unfold().out().where(without("directFriends")) ``` The query is obviously not optimally formulated, but reproduces the issue -- 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. To unsubscribe, e-mail: commits-unsubscr...@tinkerpop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org