[
https://issues.apache.org/jira/browse/TINKERPOP-2957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17744154#comment-17744154
]
ASF GitHub Bot commented on TINKERPOP-2957:
-------------------------------------------
spmallette commented on code in PR #2127:
URL: https://github.com/apache/tinkerpop/pull/2127#discussion_r1266565667
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##########
@@ -2554,21 +2557,30 @@ public default GraphTraversal<S, E> property(final
VertexProperty.Cardinality ca
*/
public default GraphTraversal<S, E> property(final Object key, final
Object value, final Object... keyValues) {
if (key instanceof VertexProperty.Cardinality) {
- if (value instanceof Map) { //Handle the property(Cardinality,
Map) signature
- final Map<Object, Object> map = (Map)value;
+ if (value instanceof Map) {
+ // Handle the property(Cardinality, Map) signature
+ final Map<Object, Object> map = (Map) value;
for (Map.Entry<Object, Object> entry : map.entrySet()) {
- property(key, entry.getKey(), entry.getValue());
+ final Object val = entry.getValue();
+ if (val instanceof CardinalityValueTraversal) {
+ final CardinalityValueTraversal cardVal =
(CardinalityValueTraversal) val;
+ property(cardVal.getCardinality(), entry.getKey(),
cardVal.getValue());
+ } else {
+ property(key, entry.getKey(), entry.getValue());
Review Comment:
hmm, that's right. it seems that has always been a problem. changing it to
prevent traversal construction if you provide that sort of input.
> mergeV with sideEffect not correctly updating properties
> --------------------------------------------------------
>
> Key: TINKERPOP-2957
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2957
> Project: TinkerPop
> Issue Type: Bug
> Components: process
> Affects Versions: 3.6.4
> Reporter: Kelvin Lawrence
> Assignee: Stephen Mallette
> Priority: Blocker
>
> A Gremlin user let me know about the following issue. If the query below is
> run twice, the name parameter on the 4567 vertex does not get updated. The
> name on the 1234 vertex does get updated. The query is written this way as
> not all databases support single cardinality as the default. The issue has
> been reproduced using both TinkerGraph and Amazon Neptune.
> {code:java}
> g.mergeV([(T.id): 'test-test-1234']).
> option(onCreate, [(T.label): 'someLabel', 'name': 'name1']).
> option(onMatch, sideEffect(property(single,"name","name2")).constant([:])).
> mergeV([(T.id): 'test-test-4567']).
> option(onCreate, [(T.label): 'someLabel', 'name': 'name1']).
> option(onMatch,
> sideEffect(property(single,"name","name2")).constant([:])){code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)