[
https://issues.apache.org/jira/browse/TINKERPOP-3295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18144085#comment-18144085
]
ASF GitHub Bot commented on TINKERPOP-3295:
-------------------------------------------
Cole-Greer commented on code in PR #3802:
URL: https://github.com/apache/tinkerpop/pull/3802#discussion_r4558100264
##########
gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature:
##########
@@ -1121,3 +1121,29 @@ Feature: Step - mergeV()
"""
When iterated to list
Then the traversal will raise an error with message containing text of
"option(onMatch) can only be specified once"
+
+ Scenario:
g_injectX1_1X_mergeVXlabel_person_name_aliceX_optionXonMatch_matched_YX
+ Given the empty graph
+ And using the parameter xx1 defined as "m[{\"t[label]\": \"person\",
\"name\":\"alice\"}]"
+ And using the parameter xx2 defined as "m[{\"matched\":\"Y\"}]"
+ And the traversal of
+ """
+ g.inject(1, 1).mergeV(xx1).option(Merge.onMatch, xx2)
+ """
+ When iterated to list
+ Then the result should have a count of 2
+ And the graph should return 1 for count of "g.V()"
+ And the graph should return 1 for count of
"g.V().has(\"person\",\"name\",\"alice\").has(\"matched\",\"Y\")"
+
+ Scenario:
g_injectXlabel_person_name_alice_label_person_name_aliceX_mergeV_optionXonMatch_matched_YX
+ Given the empty graph
+ And using the parameter xx1 defined as "m[{\"t[label]\": \"person\",
\"name\":\"alice\"}]"
+ And using the parameter xx2 defined as "m[{\"matched\":\"Y\"}]"
+ And the traversal of
+ """
+ g.inject(xx1, xx1).mergeV().option(Merge.onMatch, xx2)
Review Comment:
The test cases here do a good job at showing a bulked traverser will first
create the vertex, and then hit the onMatch in the next iteration. Can we
include an additional test which shows how many times onMatch runs with bulks
greater than 2? I think something like this should do the trick:
```
g.inject(xx1, xx1, xx1, xx1).mergeV().option(Merge.onMatch,
__.project("matchCount").by(coalesce(values("matchCount").math("_ + 1"),
constant(1))))
```
I would expect this to result in a single vertex with a `matchCount`
property of `3.0` (skipped on creation, and then incremented 3 times). Could we
add a test like this here and for `mergeE`?
> inject() and addV() has bulking issues
> --------------------------------------
>
> Key: TINKERPOP-3295
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3295
> Project: TinkerPop
> Issue Type: Bug
> Components: process
> Affects Versions: 3.7.7
> Reporter: Stephen Mallette
> Priority: Critical
>
> {code}
> gremlin> g.inject(1,1).addV('X').id()
> ==>0
> ==>0
> gremlin> g.V().count()
> ==>1
> {code}
> the example is for {{addV()}} and the {{inject()}} start step but
> investigation should probably cover other variations of mutations like,
> {{addE()}}, {{mergeV/E()}} and {{drop()}} and steps and mid-traversal
> {{inject()}}.
> Should also cover cases like: {{g.inject(1, 1).addV('X').property(T.id,
> 'same')}}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)