steigma commented on code in PR #2504:
URL: https://github.com/apache/tinkerpop/pull/2504#discussion_r1504375887
##########
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/FilterRankingStrategyTest.java:
##########
@@ -85,44 +86,148 @@ public void doTest() {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> generateTestParameters() {
final Predicate testP = t -> true;
+
return Arrays.asList(new Object[][]{
- {__.dedup().order(), __.dedup().order(),
Collections.emptyList()},
- {__.has("name", "marko").as("a").out().as("b").has("age",
32).where("a", neq("b")).as("c").out(), __.has("name",
"marko").as("a").out().has("age", 32).as("b").where("a",
neq("b")).as("c").out(), Collections.emptyList()},
- {__.has("name", "marko").as("a").out().has("age",
32).as("b").where("a", neq("b")), __.has("name",
"marko").as("a").out().has("age", 32).as("b").where("a", neq("b")),
Collections.emptyList()},
- {__.has("name", "marko").has("age", 32).dedup().has("name",
"bob").as("a"), __.has("name", "marko").has("age", 32).has("name",
"bob").dedup().as("a"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.has("name", "marko").dedup().as("a").has("age",
32).has("name", "bob").as("b"), __.has("name", "marko").has("age",
32).has("name", "bob").dedup().as("b", "a"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.where("b", eq("c")).as("a").dedup("a").has("name",
"marko"), __.has("name", "marko").where("b", eq("c")).as("a").dedup("a"),
Collections.emptyList()},
- {__.where("b", eq("c")).has("name",
"bob").as("a").dedup("a").has("name", "marko"), __.has("name",
"bob").has("name", "marko").where("b", eq("c")).as("a").dedup("a"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.has("name", "marko").as("a").out().has("name",
"bob").dedup().as("b").where(__.as("a").out().as("b")), __.has("name",
"marko").as("a").out().has("name",
"bob").dedup().as("b").where(__.as("a").out().as("b")),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.has("name", "marko").as("a").out().has("name",
"bob").as("b").dedup().where(__.as("a").out().as("b")), __.has("name",
"marko").as("a").out().has("name",
"bob").dedup().as("b").where(__.as("a").out().as("b")),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.has("name", "marko").as("a").out().has("name",
"bob").dedup().as("c").where(__.as("a").out().as("b")), __.has("name",
"marko").as("a").out().has("name",
"bob").where(__.as("a").out().as("b")).dedup().as("c"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.order().dedup(), __.dedup().order(),
Collections.emptyList()},
- {__.order().filter(testP).dedup(),
__.order().filter(testP).dedup(), Collections.emptyList()},
- {__.order().as("a").dedup(), __.dedup().order().as("a"),
Collections.emptyList()},
- {__.order().as("a").dedup("a"), __.order().as("a").dedup("a"),
Collections.emptyList()},
- {__.order().as("a").dedup("a").has("name", "marko"),
__.has("name", "marko").as("a").dedup("a").order(), Collections.emptyList()},
- {__.order().as("a").dedup("a").has("name", "marko").out(),
__.has("name", "marko").as("a").dedup("a").order().out(),
Collections.emptyList()},
- {__.order().as("a").dedup("a").has("name", "marko").where("a",
eq("b")).out(), __.has("name", "marko").as("a").where("a",
eq("b")).dedup("a").order().out(), Collections.emptyList()},
- {__.identity().order().dedup(), __.dedup().order(),
Collections.singletonList(IdentityRemovalStrategy.instance())},
- {__.order().identity().dedup(), __.dedup().order(),
Collections.singletonList(IdentityRemovalStrategy.instance())},
- {__.order().out().dedup(), __.order().out().dedup(),
Collections.emptyList()},
- {has("value", 0).filter(out()).dedup(), has("value",
0).filter(out()).dedup(), Collections.emptyList()},
- {__.dedup().has("value", 0).or(not(has("age")), has("age",
10)).has("value", 1), __.has("value", 0).has("value", 1).or(not(has("age")),
has("age", 10)).dedup(),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.dedup().filter(out()).has("value", 0), has("value",
0).filter(out()).dedup(), Collections.emptyList()},
- {filter(out()).dedup().has("value", 0), has("value",
0).filter(out()).dedup(), Collections.emptyList()},
- {__.as("a").out().has("age").where(P.eq("a")),
__.as("a").out().where(P.eq("a")).has("age"), Collections.emptyList()},
- {__.as("a").out().has("age").where(P.eq("a")).by("age"),
__.as("a").out().has("age").where(P.eq("a")).by("age"),
Collections.emptyList()},
- {__.as("a").out().and(has("age"),
has("name")).where(P.eq("a")).by("age"), __.as("a").out().and(has("age"),
has("name")).where(P.eq("a")).by("age"), Collections.emptyList()},
- {__.as("a").out().and(has("age"),
has("name")).where(P.eq("a")),
__.as("a").out().where(P.eq("a")).and(has("age"), has("name")),
Collections.emptyList()},
- {__.as("a").out().and(has("age"),
has("name")).where(P.eq("a")).by("age"),
__.as("a").out().has("age").has("name").where(P.eq("a")).by("age"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.as("a").out().and(has("age"),
has("name")).where(P.eq("a")),
__.as("a").out().where(P.eq("a")).has("age").has("name"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.as("a").out().and(has("age"),
has("name")).filter(__.where(P.eq("a"))),
__.as("a").out().where(P.eq("a")).has("age").has("name"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {__.as("a").out().and(has("age"),
has("name")).filter(__.where(P.eq("a")).by("age")),
__.as("a").out().has("age").has("name").where(P.eq("a")).by("age"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {has("value", 0).filter(out()).dedup(), has("value",
0).filter(out()).dedup(), Collections.emptyList()},
- {has("value", 0).or(has("name"), has("age")).has("value",
1).dedup(), has("value", 0).has("value", 1).or(has("name"),
has("age")).dedup(),
Collections.singletonList(InlineFilterStrategy.instance())},
- {has("value", 0).or(out(),
in()).as(Graph.Hidden.hide("x")).has("value", 1).dedup(), has("value",
0).has("value", 1).or(outE(), inE()).dedup(),
TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
- {has("value", 0).and(has("age"), has("name", "marko")).is(10),
__.is(10).has("value", 0).has("age").has("name", "marko"),
Collections.singletonList(InlineFilterStrategy.instance())},
- {has("value", 0).filter(or(not(has("age")), has("age",
1))).has("value", 1).dedup(), has("value", 0).has("value",
1).or(not(filter(properties("age"))), has("age", 1)).dedup(),
TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
Review Comment:
I reformatted these tests slightly and added some new ones on the top
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]