Skip to content

Commit eeaf6b1

Browse files
author
valentynk
committed
resolve merge conflicts
2 parents d454934 + 7fbc3b9 commit eeaf6b1

File tree

5 files changed

+40
-4
lines changed

5 files changed

+40
-4
lines changed

CHANGELOG.asciidoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ This release also includes changes from <<release-3-5-7, 3.5.7>>.
7979
* Fixed bug with `fail` step not working with a `VertexProgram` running on the server.
8080
* Introduced mime type `application/vnd.gremlin-v1.0+json;typed=false` to allow direct specification of GraphSON 1.0 without types.
8181
* Introduced mime type `application/vnd.gremlin-v2.0+json;typed=false` to allow direct specification of GraphSON 2.0 without types.
82-
* Removed `final` class declaration for `LabelStep`
82+
* Removed `final` class declaration for `LabelStep`.
83+
* Fixed MergeE/MergeV steps to always throw exception for invalid `onMatch` option.
8384
8485
[[release-3-6-4]]
8586
=== TinkerPop 3.6.4 (Release Date: May 12, 2023)

gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeEdgeStep.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
3434
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
3535
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
36+
import org.apache.tinkerpop.gremlin.process.traversal.lambda.ConstantTraversal;
3637
import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event;
3738
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy;
3839
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
@@ -265,6 +266,10 @@ protected Iterator<Edge> flatMap(final Traverser.Admin<S> traverser) {
265266
Iterator<Edge> edges = searchEdges(mergeMap);
266267

267268
if (onMatchTraversal != null) {
269+
if (onMatchTraversal instanceof ConstantTraversal) {
270+
final Map matchMap = onMatchTraversal.next();
271+
validateMapInput(matchMap, true);
272+
}
268273

269274
edges = IteratorUtils.peek(edges, e -> {
270275

gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeVertexStep.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@
2828

2929
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
3030
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
31-
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
3231
import org.apache.tinkerpop.gremlin.process.traversal.lambda.CardinalityValueTraversal;
33-
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep;
32+
import org.apache.tinkerpop.gremlin.process.traversal.lambda.ConstantTraversal;
3433
import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event;
3534
import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy;
3635
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -87,6 +86,11 @@ protected Iterator<Vertex> flatMap(final Traverser.Admin<S> traverser) {
8786
Iterator<Vertex> vertices = searchVertices(mergeMap);
8887

8988
if (onMatchTraversal != null) {
89+
if (onMatchTraversal instanceof ConstantTraversal) {
90+
final Map matchMap = onMatchTraversal.next();
91+
validateMapInput(matchMap, true);
92+
}
93+
9094
// attach the onMatch properties
9195
vertices = IteratorUtils.peek(vertices, v -> {
9296

gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeEdge.feature

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,3 +853,18 @@ Feature: Step - mergeE()
853853
And the graph should return 1 for count of "g.E()"
854854
And the graph should return 1 for count of "g.V(1).out(\"knows\").hasId(2)"
855855

856+
# cannot use hidden namespace for label key for onMatch
857+
Scenario: g_V_asXvX_mergeEXxx1X_optionXMerge_onMatch_xx2X_optionXMerge_outV_selectXvXX_optionXMerge_inV_selectXvXX
858+
Given the empty graph
859+
And the graph initializer of
860+
"""
861+
g.addV("person").property("name", "marko").property("age", 29)
862+
"""
863+
And using the parameter xx1 defined as "m[{\"t[label]\": \"self\", \"D[OUT]\":\"M[outV]\", \"D[IN]\":\"M[inV]\"}]"
864+
And using the parameter xx2 defined as "m[{\"~label\":\"vertex\"}]"
865+
And the traversal of
866+
"""
867+
g.V().as("v").mergeE(xx1).option(Merge.onMatch,xx2).option(Merge.outV,select("v")).option(Merge.inV,select("v"))
868+
"""
869+
When iterated to list
870+
Then the traversal will raise an error with message containing text of "Property key can not be a hidden key: ~label"

gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,4 +955,15 @@ Feature: Step - mergeV()
955955
And the graph should return 0 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\", 33)"
956956
And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\", 31)"
957957
And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\")"
958-
And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").properties(\"age\")"
958+
And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").properties(\"age\")"
959+
960+
# cannot use hidden namespace for label key for onMatch
961+
Scenario: g_mergeV_hidden_label_key_onMatch_matched_prohibited
962+
Given the empty graph
963+
And using the parameter xx1 defined as "m[{\"~label\":\"vertex\"}]"
964+
And the traversal of
965+
"""
966+
g.mergeV([:]).option(Merge.onMatch, xx1)
967+
"""
968+
When iterated to list
969+
Then the traversal will raise an error with message containing text of "Property key can not be a hidden key: ~label"

0 commit comments

Comments
 (0)