[ https://issues.apache.org/jira/browse/TINKERPOP-2816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
pieter martin updated TINKERPOP-2816: ------------------------------------- Description: Sqlg is encountering some issues when running the Gherkin feature tests. h2. g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name {code:java} Scenario: g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name Given the modern graph And the traversal of """ g.V().repeat(__.out().repeat(__.out()).times(1)).times(1).limit(1).path().by("name") """ When iterated next Then the result should be unordered | result | | marko | | josh | | ripple | {code} This test assumes an implicit order in the traversal. To fix the test we need to add in an {{order().by("name")}} {code:java} Scenario: g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name Given the modern graph And the traversal of """ g.V().repeat(__.out().repeat(__.out().order().by("name", Order.desc)).times(1)).times(1).limit(1).path().by("name") """ When iterated next Then the result should be unordered | result | | marko | | josh | | ripple | {code} h2. g_V_both_both_dedup_byXoutE_countX_name {code:java} Scenario: g_V_both_both_dedup_byXoutE_countX_name Given the modern graph And the traversal of """ g.V().both().both().dedup().by(__.outE().count()).values("name") """ When iterated to list Then the result should be unordered | result | | marko | | josh | | peter | | ripple | {code} This test assumes the order of {{{}V().both().both(){}}}. Unfortunately putting in an {{order().by("name")}} does not help. This is because of a second bug where {{TinkerPop}} is rewriting the steps incorrectly. {code:java} @Test public void testDedupSteps() { final TinkerGraph g = TinkerFactory.createModern(); GraphTraversal<Vertex, String> traversal = g.traversal().V().both().both().order().by("name", Order.asc).dedup().by(__.outE().count()).<String>values("name"); traversal.hasNext(); System.out.println(((DefaultGraphTraversal)traversal).getSteps()); } {code} This produces, {code:java} [TinkerGraphStep(vertex,[]), VertexStep(BOTH,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex), DedupGlobalStep(null,[VertexStep(OUT,edge), CountGlobalStep]), OrderGlobalStep([[value([CoalesceStep([value(name), (null)])]), asc]]), PropertiesStep([name],value)] {code} For some reason the {{OrderGlobalStep}} is moved to the end, after the {{DedupGlobalStep}} h2. g_V_playlist_paths {code:java} Scenario: g_V_playlist_paths Given the grateful graph And the traversal of """ g.V().has("name", "Bob_Dylan"). in("sungBy").order().by('name').as("a"). repeat(__.out().order().by('name').simplePath().from("a")). until(__.out("writtenBy").has("name", "Johnny_Cash")).limit(1).as("b"). repeat(__.out().order().by('name').as("c").simplePath().from("b").to("c")). until(__.out("sungBy").has("name", "Grateful_Dead")).limit(1). path().from("a").unfold(). project("song", "artists"). by("name"). by(__.coalesce(__.out("sungBy", "writtenBy").dedup().values("name").order(), __.constant("Unknown")).fold()) """ When iterated to list Then the result should be unordered | result | | m[{"song": "CHIMES OF FREEDOM", "artists": ["Bob_Dylan"]}] | | m[{"song": "QUEEN JANE", "artists": ["Unknown"]}] | | m[{"song": "ALTHEA", "artists": ["Garcia","Hunter"]}] | | m[{"song": "BIG RIVER", "artists": ["Johnny_Cash","Weir"]}] | | m[{"song": "HES GONE", "artists": ["Garcia","Hunter"]}] | | m[{"song": "CAUTION", "artists": ["Grateful_Dead"]}] | {code} This test also assumes `order`. Even though it has `__.out().order().by('name')` it is the path that needs to be ordered. Ordering on `name` is not good enough as there are duplicates. Here is an improved version. {code:java} List<Map<String, Object>> result = g.traversal().V().has("name", "Bob_Dylan"). in("sungBy").order().by("name").as("a"). // repeat(__.out().order().by("name").simplePath().from("a")). repeat(__.out().order().by(__.path().by("name").map(pathTraverser -> pathTraverser.get().toString()), String::compareTo).simplePath().from("a")). until(__.out("writtenBy").has("name", "Johnny_Cash")).limit(1).as("b"). // repeat(__.out().order().by("name").as("c").simplePath().from("b").to("c")). repeat(__.out().order().by(__.path().by("name").map(pathTraverser -> pathTraverser.get().toString()), String::compareTo).as("c").simplePath().from("b").to("c")). until(__.out("sungBy").has("name", "Grateful_Dead")).limit(1). path().from("a").unfold(). project("song", "artists"). by("name"). by(__.coalesce(__.out("sungBy", "writtenBy").dedup().values("name").order(), __.constant("Unknown")).fold()).toList(); List<Map<String, Object>> expected = Arrays.asList( new HashMap<String, Object>() {{ put("song", "CHIMES OF FREEDOM"); put("artists", Arrays.asList("Bob_Dylan")); }}, new HashMap<String, Object>() {{ put("song", "QUEEN JANE"); put("artists", Arrays.asList("Unknown")); }}, new HashMap<String, Object>() {{ put("song", "ALTHEA"); put("artists", Arrays.asList("Garcia", "Hunter")); }}, new HashMap<String, Object>() {{ put("song", "BIG RIVER"); put("artists", Arrays.asList("Johnny_Cash", "Weir")); }}, new HashMap<String, Object>() {{ put("song", "BERTHA"); put("artists", Arrays.asList("Garcia", "Hunter")); }}, new HashMap<String, Object>() {{ put("song", "DRUMS"); put("artists", Arrays.asList("Grateful_Dead")); }} ); Assert.assertEquals(expected, result); {code} was: Sqlg is encountering some issues when running the Gherkin feature tests. h2. g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name {code:java} Scenario: g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name Given the modern graph And the traversal of """ g.V().repeat(__.out().repeat(__.out()).times(1)).times(1).limit(1).path().by("name") """ When iterated next Then the result should be unordered | result | | marko | | josh | | ripple | {code} This test assumes an implicit order in the traversal. To fix the test we need to add in an {{order().by("name")}} {code:java} Scenario: g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name Given the modern graph And the traversal of """ g.V().repeat(__.out().repeat(__.out().order().by("name", Order.desc)).times(1)).times(1).limit(1).path().by("name") """ When iterated next Then the result should be unordered | result | | marko | | josh | | ripple | {code} h2. g_V_both_both_dedup_byXoutE_countX_name {code:java} Scenario: g_V_both_both_dedup_byXoutE_countX_name Given the modern graph And the traversal of """ g.V().both().both().dedup().by(__.outE().count()).values("name") """ When iterated to list Then the result should be unordered | result | | marko | | josh | | peter | | ripple | {code} This test assumes the order of {{{}V().both().both(){}}}. Unfortunately putting in an {{order().by("name")}} does not help. This is because of a second bug where {{TinkerPop}} is rewriting the steps incorrectly. {code:java} @Test public void testDedupSteps() { final TinkerGraph g = TinkerFactory.createModern(); GraphTraversal<Vertex, String> traversal = g.traversal().V().both().both().order().by("name", Order.asc).dedup().by(__.outE().count()).<String>values("name"); traversal.hasNext(); System.out.println(((DefaultGraphTraversal)traversal).getSteps()); } {code} This produces, {code:java} [TinkerGraphStep(vertex,[]), VertexStep(BOTH,vertex), NoOpBarrierStep(2500), VertexStep(BOTH,vertex), DedupGlobalStep(null,[VertexStep(OUT,edge), CountGlobalStep]), OrderGlobalStep([[value([CoalesceStep([value(name), (null)])]), asc]]), PropertiesStep([name],value)] {code} For some reason the {{OrderGlobalStep}} is moved to the end, after the {{DedupGlobalStep}} > Gherkin test issues for implementers > ------------------------------------ > > Key: TINKERPOP-2816 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2816 > Project: TinkerPop > Issue Type: Bug > Components: test-suite > Affects Versions: 3.6.1 > Reporter: pieter martin > Priority: Major > > Sqlg is encountering some issues when running the Gherkin feature tests. > h2. g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name > {code:java} > Scenario: > g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name > Given the modern graph > And the traversal of > """ > > g.V().repeat(__.out().repeat(__.out()).times(1)).times(1).limit(1).path().by("name") > """ > When iterated next > Then the result should be unordered > | result | > | marko | > | josh | > | ripple | > {code} > This test assumes an implicit order in the traversal. To fix the test we need > to add in an {{order().by("name")}} > {code:java} > Scenario: > g_V_repeatXout_repeatXoutX_timesX1XX_timesX1X_limitX1X_path_by_name > Given the modern graph > And the traversal of > """ > g.V().repeat(__.out().repeat(__.out().order().by("name", > Order.desc)).times(1)).times(1).limit(1).path().by("name") > """ > When iterated next > Then the result should be unordered > | result | > | marko | > | josh | > | ripple | > {code} > h2. g_V_both_both_dedup_byXoutE_countX_name > {code:java} > Scenario: g_V_both_both_dedup_byXoutE_countX_name > Given the modern graph > And the traversal of > """ > g.V().both().both().dedup().by(__.outE().count()).values("name") > """ > When iterated to list > Then the result should be unordered > | result | > | marko | > | josh | > | peter | > | ripple | > {code} > This test assumes the order of {{{}V().both().both(){}}}. > Unfortunately putting in an {{order().by("name")}} does not help. This is > because of a second bug where {{TinkerPop}} is rewriting the steps > incorrectly. > {code:java} > @Test > public void testDedupSteps() { > final TinkerGraph g = TinkerFactory.createModern(); > GraphTraversal<Vertex, String> traversal = > g.traversal().V().both().both().order().by("name", > Order.asc).dedup().by(__.outE().count()).<String>values("name"); > traversal.hasNext(); > System.out.println(((DefaultGraphTraversal)traversal).getSteps()); > } > {code} > This produces, > {code:java} > [TinkerGraphStep(vertex,[]), VertexStep(BOTH,vertex), NoOpBarrierStep(2500), > VertexStep(BOTH,vertex), DedupGlobalStep(null,[VertexStep(OUT,edge), > CountGlobalStep]), OrderGlobalStep([[value([CoalesceStep([value(name), > (null)])]), asc]]), PropertiesStep([name],value)] > {code} > For some reason the {{OrderGlobalStep}} is moved to the end, after the > {{DedupGlobalStep}} > h2. g_V_playlist_paths > {code:java} > Scenario: g_V_playlist_paths > Given the grateful graph > And the traversal of > """ > g.V().has("name", "Bob_Dylan"). > in("sungBy").order().by('name').as("a"). > repeat(__.out().order().by('name').simplePath().from("a")). > until(__.out("writtenBy").has("name", > "Johnny_Cash")).limit(1).as("b"). > > repeat(__.out().order().by('name').as("c").simplePath().from("b").to("c")). > until(__.out("sungBy").has("name", "Grateful_Dead")).limit(1). > path().from("a").unfold(). > project("song", "artists"). > by("name"). > by(__.coalesce(__.out("sungBy", > "writtenBy").dedup().values("name").order(), __.constant("Unknown")).fold()) > """ > When iterated to list > Then the result should be unordered > | result | > | m[{"song": "CHIMES OF FREEDOM", "artists": ["Bob_Dylan"]}] | > | m[{"song": "QUEEN JANE", "artists": ["Unknown"]}] | > | m[{"song": "ALTHEA", "artists": ["Garcia","Hunter"]}] | > | m[{"song": "BIG RIVER", "artists": ["Johnny_Cash","Weir"]}] | > | m[{"song": "HES GONE", "artists": ["Garcia","Hunter"]}] | > | m[{"song": "CAUTION", "artists": ["Grateful_Dead"]}] | > {code} > This test also assumes `order`. Even though it has > `__.out().order().by('name')` it is the path that needs to be ordered. > Ordering on `name` is not good enough as there are duplicates. > Here is an improved version. > {code:java} > List<Map<String, Object>> result = g.traversal().V().has("name", > "Bob_Dylan"). > in("sungBy").order().by("name").as("a"). > // repeat(__.out().order().by("name").simplePath().from("a")). > > repeat(__.out().order().by(__.path().by("name").map(pathTraverser -> > pathTraverser.get().toString()), String::compareTo).simplePath().from("a")). > until(__.out("writtenBy").has("name", > "Johnny_Cash")).limit(1).as("b"). > // > repeat(__.out().order().by("name").as("c").simplePath().from("b").to("c")). > > repeat(__.out().order().by(__.path().by("name").map(pathTraverser -> > pathTraverser.get().toString()), > String::compareTo).as("c").simplePath().from("b").to("c")). > until(__.out("sungBy").has("name", "Grateful_Dead")).limit(1). > path().from("a").unfold(). > project("song", "artists"). > by("name"). > by(__.coalesce(__.out("sungBy", > "writtenBy").dedup().values("name").order(), > __.constant("Unknown")).fold()).toList(); > List<Map<String, Object>> expected = Arrays.asList( > new HashMap<String, Object>() {{ > put("song", "CHIMES OF FREEDOM"); > put("artists", Arrays.asList("Bob_Dylan")); > }}, > new HashMap<String, Object>() {{ > put("song", "QUEEN JANE"); > put("artists", Arrays.asList("Unknown")); > }}, > new HashMap<String, Object>() {{ > put("song", "ALTHEA"); > put("artists", Arrays.asList("Garcia", "Hunter")); > }}, > new HashMap<String, Object>() {{ > put("song", "BIG RIVER"); > put("artists", Arrays.asList("Johnny_Cash", "Weir")); > }}, > new HashMap<String, Object>() {{ > put("song", "BERTHA"); > put("artists", Arrays.asList("Garcia", "Hunter")); > }}, > new HashMap<String, Object>() {{ > put("song", "DRUMS"); > put("artists", Arrays.asList("Grateful_Dead")); > }} > ); > Assert.assertEquals(expected, result); > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)