[
https://issues.apache.org/jira/browse/TINKERPOP-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778808#comment-17778808
]
ASF GitHub Bot commented on TINKERPOP-3008:
-------------------------------------------
Cole-Greer commented on code in PR #2306:
URL: https://github.com/apache/tinkerpop/pull/2306#discussion_r1369195143
##########
docs/src/upgrade/release-3.7.x.asciidoc:
##########
@@ -30,7 +30,32 @@ complete list of all the modifications that are part of this
release.
=== Upgrading for Users
==== String Manipulation Steps
-Additional String manipulation steps have been added to this version.
+Modifications to the concat() step as well as additional String manipulation
steps have been added to this version.
+
+===== Updates to concat():
+Concat has been modified to take traversal varargs instead of a single
traversal. Users no longer have to chain
+concat() steps together to concatenate multiple traversals:
+[source,text]
+----
+gremlin> g.V(1).outE().as("a").V(1).values("name").concat(select("a").label(),
select("a").inV().values("name"))
+==>markocreatedlop
+==>markoknowsvadas
+==>markoknowsjosh
+----
+
+A notable breaking change from 3.7.0 is that we have corrected the behavior of
concat() to not special treat inject()
+in arguments. The inject() step injects the incoming traverser as the first
item in the stream by default. We mistakenly
+skipped it and used its child traversal value in 3.7.0 based on false
expectation of how inject behaves. The
+behavior below is the expected outcome of inject in arguments.
+[source,text]
+----
+gremlin> g.inject("a").concat(inject())
+==>aa
+gremlin> g.inject("a").concat(inject("b"))
+==>aa
+----
Review Comment:
I don't think this needs to focus too much on implementation details or
motivation. I would suggest shortening it and focusing on describing the
differences.
```suggestion
A notable breaking change from 3.7.0 is that we have output order of
`inject()` as a child of `concat()` to be consistent with other parent steps.
Any 3.7.0 uses of `concat(inject(X))` should change to `concat(constant(X))` to
retain the old semantics.
[source,text]
----
// 3.7.0
gremlin> g.inject("a").concat(inject("b"))
==>ab
// 3.7.1
gremlin> g.inject("a").concat(inject())
==>aa
gremlin> g.inject("a").concat(inject("b"))
==>aa
gremlin> g.inject("a").concat(constant("b"))
==>ab
----
```
> Update concat() to accept traversal varargs and remove special treatment of
> inject child traversals
> ---------------------------------------------------------------------------------------------------
>
> Key: TINKERPOP-3008
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3008
> Project: TinkerPop
> Issue Type: Task
> Components: process
> Affects Versions: 3.7.0
> Reporter: Yang Xia
> Priority: Major
> Labels: breaking
>
> As proposed on the devlist, updating concat() to accept traversal varags.
> Also to update `concat()` to not special treat `inject()` in parameters and
> use `TraversalUtil.apply` on it as with any other child traversals.
> So the corrected result as inject() behaves by default (The inject() step
> injects the incoming traverser as the first item in the stream by default)
> would be:
> {code:java}
> gremlin> g.inject("a").concat(inject("b"))
> ==>aa{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)