[jira] [Closed] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread Yang Xia (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yang Xia closed TINKERPOP-2978.
---
Fix Version/s: 3.7.1
 Assignee: Ken Hu
   Resolution: Fixed

> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Assignee: Ken Hu
>Priority: Major
> Fix For: 3.7.1
>
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778876#comment-17778876
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu merged PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302




> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2999) 3.7.0 Remote Console Sends Incomplete Queries

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778873#comment-17778873
 ] 

ASF GitHub Bot commented on TINKERPOP-2999:
---

kenhuuu commented on PR #2297:
URL: https://github.com/apache/tinkerpop/pull/2297#issuecomment-1776282756

   VOTE +1




> 3.7.0 Remote Console Sends Incomplete Queries
> -
>
> Key: TINKERPOP-2999
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2999
> Project: TinkerPop
>  Issue Type: Bug
>  Components: console
>Affects Versions: 3.7.0
>Reporter: Ken Hu
>Priority: Critical
>
> As reported by user "pdsway" on gremlin-users.
> In remote console mode the 3.7.0 Gremlin Console will send incomplete queries 
> to the server causing a parsing error.
> This is caused by the upgrade to Groovy 4. That version of Groovy uses the 
> newer antlr4 parser which throws errors later in execution. So even if the 
> parser says the the line is COMPLETE, it could still be incomplete. We need 
> to add the same try catch to the remote console's execution to make the 
> handling the same as groovysh.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Assigned] (TINKERPOP-2334) Add format() step

2023-10-23 Thread Valentyn Kahamlyk (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Valentyn Kahamlyk reassigned TINKERPOP-2334:


Assignee: Valentyn Kahamlyk

> Add format() step
> -
>
> Key: TINKERPOP-2334
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2334
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: process
>Affects Versions: 3.4.4
>Reporter: Stephen Mallette
>Assignee: Valentyn Kahamlyk
>Priority: Major
>
> Provide for a {{format()}} step which will handle result formatting to string 
> values. This change will help resolve the need for string concatenation 
> functions while providing a lot of flexibility to how results can be formed:
> {code}
> gremlin> g.V().hasLabel('person').format("%{n} is %{a} years old.").by('n',
> 'name').by('a', 'age')
> ==>marko is 29 years old.
> ==>vadas is 27 years old.
> ==>josh is 32 years old.
> ==>peter is 35 years old.
> gremlin> g.V().hasLabel('person').format("%{name} is %{age} years old.")
> ==>marko is 29 years old.
> ==>vadas is 27 years old.
> ==>josh is 32 years old.
> ==>peter is 35 years old.
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2334) Add format() step

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778867#comment-17778867
 ] 

ASF GitHub Bot commented on TINKERPOP-2334:
---

codecov-commenter commented on PR #2307:
URL: https://github.com/apache/tinkerpop/pull/2307#issuecomment-1776237912

   ## 
[Codecov](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache)
 Report
   > Merging 
[#2307](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache)
 (09aab9d) into 
[master](https://app.codecov.io/gh/apache/tinkerpop/commit/8ba85676aa37e90c877f50b971451dbd376b5b9f?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache)
 (8ba8567) will **increase** coverage by `0.23%`.
   > Report is 17 commits behind head on master.
   > The diff coverage is `96.05%`.
   
   ```diff
   @@ Coverage Diff  @@
   ## master#2307  +/-   ##
   
   + Coverage 75.93%   76.17%   +0.23% 
   - Complexity1276512785  +20 
   
 Files  1062 1038  -24 
 Lines 6441260633-3779 
 Branches   7118 7139  +21 
   
   - Hits  4890946185-2724 
   + Misses1285211980 -872 
   + Partials   2651 2468 -183 
   ```
   
   
   | 
[Files](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...emlin/language/grammar/TraversalMethodVisitor.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9sYW5ndWFnZS9ncmFtbWFyL1RyYXZlcnNhbE1ldGhvZFZpc2l0b3IuamF2YQ==)
 | `92.14% <100.00%> (+0.09%)` | :arrow_up: |
   | 
[...in/process/traversal/dsl/graph/GraphTraversal.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9wcm9jZXNzL3RyYXZlcnNhbC9kc2wvZ3JhcGgvR3JhcGhUcmF2ZXJzYWwuamF2YQ==)
 | `93.05% <100.00%> (+0.16%)` | :arrow_up: |
   | 
[...kerpop/gremlin/process/traversal/dsl/graph/\_\_.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9wcm9jZXNzL3RyYXZlcnNhbC9kc2wvZ3JhcGgvX18uamF2YQ==)
 | `79.79% <100.00%> (+0.10%)` | :arrow_up: |
   | 
[...process/traversal/translator/PythonTranslator.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9wcm9jZXNzL3RyYXZlcnNhbC90cmFuc2xhdG9yL1B5dGhvblRyYW5zbGF0b3IuamF2YQ==)
 | `71.28% <100.00%> (+0.14%)` | :arrow_up: |
   | 
[...gremlin/process/traversal/util/BytecodeHelper.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9wcm9jZXNzL3RyYXZlcnNhbC91dGlsL0J5dGVjb2RlSGVscGVyLmphdmE=)
 | `86.45% <100.00%> (+0.07%)` | :arrow_up: |
   | 
[...in/language/grammar/DefaultGremlinBaseVisitor.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9sYW5ndWFnZS9ncmFtbWFyL0RlZmF1bHRHcmVtbGluQmFzZVZpc2l0b3IuamF2YQ==)
 | `0.24% <0.00%> (-0.01%)` | :arrow_down: |
   | 
[...gremlin/process/traversal/step/map/FormatStep.java](https://app.codecov.io/gh/apache/tinkerpop/pull/2307?src=pr=tree_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache#diff-Z3JlbWxpbi1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS90aW5rZXJwb3AvZ3JlbWxpbi9wcm9jZXNzL3RyYXZlcnNhbC9zdGVwL21hcC9Gb3JtYXRTdGVwLmphdmE=)
 | `97.10% <97.10%> (ø)` | |
   
   ... and [44 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/tinkerpop/pull/2307/indirect-changes?src=pr=tree-more_medium=referral_source=github_content=comment_campaign=pr+comments_term=apache)
   
   :mega: We’re building smart automated test selection to slash your CI/CD 
build times. [Learn 

[jira] [Commented] (TINKERPOP-2999) 3.7.0 Remote Console Sends Incomplete Queries

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778866#comment-17778866
 ] 

ASF GitHub Bot commented on TINKERPOP-2999:
---

Cole-Greer commented on PR #2297:
URL: https://github.com/apache/tinkerpop/pull/2297#issuecomment-1776237588

   Thanks Ryan, LGTM.
   
   VOTE +1




> 3.7.0 Remote Console Sends Incomplete Queries
> -
>
> Key: TINKERPOP-2999
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2999
> Project: TinkerPop
>  Issue Type: Bug
>  Components: console
>Affects Versions: 3.7.0
>Reporter: Ken Hu
>Priority: Critical
>
> As reported by user "pdsway" on gremlin-users.
> In remote console mode the 3.7.0 Gremlin Console will send incomplete queries 
> to the server causing a parsing error.
> This is caused by the upgrade to Groovy 4. That version of Groovy uses the 
> newer antlr4 parser which throws errors later in execution. So even if the 
> parser says the the line is COMPLETE, it could still be incomplete. We need 
> to add the same try catch to the remote console's execution to make the 
> handling the same as groovysh.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (TINKERPOP-3004) Low performance for queries with a large number of element comparisons

2023-10-23 Thread Cole Greer (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cole Greer updated TINKERPOP-3004:
--
Fix Version/s: (was: 3.6.6)

> Low performance for queries with a large number of element comparisons
> --
>
> Key: TINKERPOP-3004
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3004
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Assignee: Valentyn Kahamlyk
>Priority: Critical
> Fix For: 3.7.1
>
>
> There is a query where need to find except of two sets of vertices using 
> `P.without`. Performance dropped significantly when moving from 3.5 to 3.7. 
> Rough estimate is at least 2 times.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Closed] (TINKERPOP-3004) Low performance for queries with a large number of element comparisons

2023-10-23 Thread Cole Greer (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cole Greer closed TINKERPOP-3004.
-
Resolution: Fixed

> Low performance for queries with a large number of element comparisons
> --
>
> Key: TINKERPOP-3004
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3004
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Assignee: Valentyn Kahamlyk
>Priority: Critical
> Fix For: 3.7.1
>
>
> There is a query where need to find except of two sets of vertices using 
> `P.without`. Performance dropped significantly when moving from 3.5 to 3.7. 
> Rough estimate is at least 2 times.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Reopened] (TINKERPOP-3004) Low performance for queries with a large number of element comparisons

2023-10-23 Thread Cole Greer (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cole Greer reopened TINKERPOP-3004:
---

> Low performance for queries with a large number of element comparisons
> --
>
> Key: TINKERPOP-3004
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3004
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Assignee: Valentyn Kahamlyk
>Priority: Critical
> Fix For: 3.6.6, 3.7.1
>
>
> There is a query where need to find except of two sets of vertices using 
> `P.without`. Performance dropped significantly when moving from 3.5 to 3.7. 
> Rough estimate is at least 2 times.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Closed] (TINKERPOP-2423) hashCode collision for steps with different attributes

2023-10-23 Thread Yang Xia (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yang Xia closed TINKERPOP-2423.
---
Fix Version/s: 3.6.6
   Resolution: Fixed

> hashCode collision for steps with different attributes
> --
>
> Key: TINKERPOP-2423
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2423
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.4.8
>Reporter: Saikiran Boga
>Assignee: Yang Xia
>Priority: Major
> Fix For: 3.6.6
>
>
> The {{hashCode computation}} for PropertiesStep collides for multiple steps 
> when there are repeating keys. For example {{.properties()}} and 
> {{.properties("a","a")}}, {{.properties("a")}} and 
> .{{properties("a","b","b")}} have the same hash code because of xor of just 
> properties here 
> [https://github.com/apache/tinkerpop/blob/cff4c161615f2b50bda27b6ba523c7f52b833532/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java#L80-L87].
>  Basically, the even keys cancel out the xor computation.
>  
> The same is also true for {{AbstractStep.hashCode}} which takes xor of labels.
> {{GraphStep}} does the same thing using ids. so {{g.V("1", "1")}} and 
> {{g.V()}} would collide during comparison. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Assigned] (TINKERPOP-2423) hashCode collision for steps with different attributes

2023-10-23 Thread Yang Xia (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yang Xia reassigned TINKERPOP-2423:
---

Assignee: Yang Xia

> hashCode collision for steps with different attributes
> --
>
> Key: TINKERPOP-2423
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2423
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.4.8
>Reporter: Saikiran Boga
>Assignee: Yang Xia
>Priority: Major
>
> The {{hashCode computation}} for PropertiesStep collides for multiple steps 
> when there are repeating keys. For example {{.properties()}} and 
> {{.properties("a","a")}}, {{.properties("a")}} and 
> .{{properties("a","b","b")}} have the same hash code because of xor of just 
> properties here 
> [https://github.com/apache/tinkerpop/blob/cff4c161615f2b50bda27b6ba523c7f52b833532/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/PropertiesStep.java#L80-L87].
>  Basically, the even keys cancel out the xor computation.
>  
> The same is also true for {{AbstractStep.hashCode}} which takes xor of labels.
> {{GraphStep}} does the same thing using ids. so {{g.V("1", "1")}} and 
> {{g.V()}} would collide during comparison. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Closed] (TINKERPOP-3004) Low performance for queries with a large number of element comparisons

2023-10-23 Thread Cole Greer (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cole Greer closed TINKERPOP-3004.
-
Fix Version/s: 3.6.6
   3.7.1
   Resolution: Fixed

> Low performance for queries with a large number of element comparisons
> --
>
> Key: TINKERPOP-3004
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3004
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Assignee: Valentyn Kahamlyk
>Priority: Critical
> Fix For: 3.6.6, 3.7.1
>
>
> There is a query where need to find except of two sets of vertices using 
> `P.without`. Performance dropped significantly when moving from 3.5 to 3.7. 
> Rough estimate is at least 2 times.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2999) 3.7.0 Remote Console Sends Incomplete Queries

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778864#comment-17778864
 ] 

ASF GitHub Bot commented on TINKERPOP-2999:
---

ryn5 commented on code in PR #2297:
URL: https://github.com/apache/tinkerpop/pull/2297#discussion_r1369404179


##
gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovysh.groovy:
##
@@ -140,4 +171,48 @@ class GremlinGroovysh extends Groovysh {
 
 maybeRecordResult(result)
 }
+
+private Object evaluateWithStoredBoundVars(String importsSpec, 
List current) {
+Object result
+String variableBlocks = null
+// To make groovysh behave more like an interpreter, we need to 
retrieve all bound
+// vars at the end of script execution, and then update them into the 
groovysh Binding context.
+Set boundVars = 
ScriptVariableAnalyzer.getBoundVars(importsSpec + Parser.NEWLINE + 
current.join(Parser.NEWLINE), interp.classLoader)
+if (boundVars) {
+variableBlocks = "$COLLECTED_BOUND_VARS_MAP_VARNAME = new 
HashMap();"
+boundVars.each({ String varname ->
+// bound vars can be in global or some local scope.
+// We discard locally scoped vars by ignoring 
MissingPropertyException
+variableBlocks += """
+try {$COLLECTED_BOUND_VARS_MAP_VARNAME[\"$varname\"] = $varname;
+} catch (MissingPropertyException e){}"""
+})
+}
+// Evaluate the current buffer w/imports and dummy statement
+List buff
+if (variableBlocks) {
+buff = [importsSpec] + ['try {', 'true'] + current + ['} finally 
{' + variableBlocks + '}']
+} else {
+buff = [importsSpec] + ['true'] + current
+}
+setLastResult(result = interp.evaluate(buff))

Review Comment:
   Confirmed that multiline queries are fixed for both interpreter modes





> 3.7.0 Remote Console Sends Incomplete Queries
> -
>
> Key: TINKERPOP-2999
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2999
> Project: TinkerPop
>  Issue Type: Bug
>  Components: console
>Affects Versions: 3.7.0
>Reporter: Ken Hu
>Priority: Critical
>
> As reported by user "pdsway" on gremlin-users.
> In remote console mode the 3.7.0 Gremlin Console will send incomplete queries 
> to the server causing a parsing error.
> This is caused by the upgrade to Groovy 4. That version of Groovy uses the 
> newer antlr4 parser which throws errors later in execution. So even if the 
> parser says the the line is COMPLETE, it could still be incomplete. We need 
> to add the same try catch to the remote console's execution to make the 
> handling the same as groovysh.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Assigned] (TINKERPOP-3004) Low performance for queries with a large number of element comparisons

2023-10-23 Thread Cole Greer (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cole Greer reassigned TINKERPOP-3004:
-

Assignee: Valentyn Kahamlyk

> Low performance for queries with a large number of element comparisons
> --
>
> Key: TINKERPOP-3004
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3004
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.7.0
>Reporter: Valentyn Kahamlyk
>Assignee: Valentyn Kahamlyk
>Priority: Critical
>
> There is a query where need to find except of two sets of vertices using 
> `P.without`. Performance dropped significantly when moving from 3.5 to 3.7. 
> Rough estimate is at least 2 times.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Closed] (TINKERPOP-3008) Update concat() to accept traversal varargs and remove special treatment of inject child traversals

2023-10-23 Thread Yang Xia (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yang Xia closed TINKERPOP-3008.
---
Fix Version/s: 3.7.1
   Resolution: Fixed

> 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
> Fix For: 3.7.1
>
>
> 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)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778863#comment-17778863
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#issuecomment-1776223289

   VOTE +1




> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778862#comment-17778862
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

Cole-Greer commented on PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#issuecomment-1776220869

   Thanks Ken, these added steps will be a huge addition to gremlin's list 
manipulation capabilities.
   
   VOTE +1




> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778861#comment-17778861
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369382783


##
docs/src/reference/the-traversal.asciidoc:
##
@@ -1140,6 +1140,24 @@ g.V().coin(1.0)
 
 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#coin-double-++[`coin(double)`]
 
+[[combine-step]]
+=== Combine Step
+
+The `combine()`-step (*map*) combines the elements of the incoming list 
traverser and the provided list argument into
+one list. This is also known as appending or concatenating. This step only 
expects list data (array or Iterable) and
+will throw an `IllegalArgumentException` if any other type is encountered 
(including null). This differs from the
+`merge` step in that it allows duplicates to exist.
+
+[gremlin-groovy,modern]
+
+g.V().values("name").fold().combine(["james","jen","marko","vadas"])

Review Comment:
   added to all steps.





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778859#comment-17778859
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#issuecomment-1776213891

   VOTE +1




> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778857#comment-17778857
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369373028


##
docs/src/dev/provider/gremlin-semantics.asciidoc:
##
@@ -725,6 +725,42 @@ 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/o
 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/service/ServiceRegistry.java[ServiceRegistry],
 link:https://tinkerpop.apache.org/docs/x.y.z/reference/#call-step[reference]
 
+[[combine-step]]
+=== combine()
+
+*Description:* Appends one list to the other and returns the result to the 
Traversal Stream.
+
+*Syntax:* `combine(Object)`
+
+[width="100%",options="header"]
+|=
+|Start Step |Mid Step |Modulated |Domain |Range
+|N |Y |N |`array`/`Iterable` |`List`
+|=
+
+*Arguments:*
+
+* `Object` - A list of items (as an Iterable or an array) a traversal that 
will produce a list of items.
+
+*Modulation:*
+
+None
+
+*Considerations:*
+
+A list is returned after the combine operation is applied so duplicates are 
allowed. `Merge` can be used instead if
+duplicates aren't wanted. This step only applies to list types which means 
that non-iterable types (including null)
+will cause exceptions to be thrown.
+
+*Exceptions*
+
+* If the incoming traverser isn't a list (array or Iterable) then an 
`IllegalArgumentException` will be thrown.
+* If the argument doesn't resolve to a list (array or Iterable) then an 
`IllegalArgumentException` will be thrown.
+
+See: 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CombineStep.java[source],
+link:https://tinkerpop.apache.org/docs/x.y.z/reference/#combine-step[reference],
+link:https://tinkerpop.apache.org/docs/x.y.z/reference/#merge-step[reference],

Review Comment:
   yes it was intended. updated to your suugestion.



##
gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Combine.feature:
##
@@ -0,0 +1,240 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+@StepClassMap @StepCombine
+Feature: Step - combine()
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_injectXnullX_combineXinjectX1XX
+Given the empty graph
+And the traversal of
+  """
+  g.inject(null).combine(__.inject(1))
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"Incoming traverser for combine step can't be null"
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_V_valuesXnameX_combineXV_foldX
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("name").combine(__.V().fold())
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"combine step can only take an array or an Iterable type for incoming 
traversers"
+
+  Scenario: g_V_fold_combineXconstantXnullXX
+Given the modern graph
+And the traversal of
+  """
+  g.V().fold().combine(__.constant(null))
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"traversal argument for combine step must yield an iterable type, not null"
+
+  @GraphComputerVerificationMidVNotSupported
+  Scenario: g_V_fold_combineXVX
+Given the modern graph
+And the traversal of
+  """
+  g.V().fold().combine(__.V())
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"traversal argument for combine step must yield an iterable type, encountered"
+
+  Scenario: g_V_valuesXnameX_fold_combineX2X
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("name").fold().combine(2)
+  """
+When iterated to list

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778858#comment-17778858
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369373320


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CombineStep.java:
##
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the combination of the traverser and the provided 
arguments. This is also commonly known as
+ * concatenation or append.
+ */
+public final class CombineStep extends ScalarMapStep> 
implements TraversalParent, ListFunction {
+private Traversal.Admin valueTraversal;
+private Object parameterItems;
+
+public CombineStep(final Traversal.Admin traversal, final Object values) {
+super(traversal);
+
+if (values instanceof Traversal) {
+valueTraversal = integrateChild(((Traversal) 
values).asAdmin());
+} else {
+parameterItems = values;
+}
+}
+
+@Override
+public String getStepName() { return "combine"; }
+
+@Override
+protected List map(Traverser.Admin traverser) {
+final Collection listA = convertTraverserToCollection(traverser);
+final Collection listB = (null != valueTraversal) ? 
convertTraversalToCollection(traverser, valueTraversal) : 
convertArgumentToCollection(parameterItems);
+
+final List combined = new ArrayList(listA);
+combined.addAll(listB);
+
+return combined;
+}
+
+@Override
+public List> getLocalChildren() {
+return (null == valueTraversal) ? Collections.emptyList() : 
Collections.singletonList(valueTraversal);
+}
+
+@Override
+public Set getRequirements() { return 
this.getSelfAndChildRequirements(); }

Review Comment:
   OBJECT is pretty much always required and so it doesn't need to be 
explicitly added here.





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778853#comment-17778853
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369372615


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConjoinStep.java:
##
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the result of joining every element in the 
traverser using the delimiter argument.
+ */
+public final class ConjoinStep extends ScalarMapStep implements 
ListFunction {

Review Comment:
   Maybe, I decided it wouldn't be that useful given that half of these fields 
are meant to be null. By default the step's name is already included in the 
toString which is probably the most important part.



##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TraversalMergeStep.java:
##
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the merger of the traverser and the provided 
arguments without duplicates. This is commonly
+ * known as a union.
+ */
+public final class TraversalMergeStep extends ScalarMapStep 
implements TraversalParent, ListFunction {
+private Traversal.Admin valueTraversal;
+private Object parameterItems;
+public TraversalMergeStep(final Traversal.Admin traversal, final Object 
values) {
+super(traversal);
+
+if (values instanceof Traversal) {
+valueTraversal = integrateChild(((Traversal) 
values).asAdmin());
+} else {
+parameterItems = values;
+}
+}
+
+@Override
+public String getStepName() { return "merge"; }
+
+@Override
+protected E map(final Traverser.Admin 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778856#comment-17778856
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369372908


##
docs/src/dev/provider/gremlin-semantics.asciidoc:
##
@@ -725,6 +725,42 @@ 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/o
 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/service/ServiceRegistry.java[ServiceRegistry],
 link:https://tinkerpop.apache.org/docs/x.y.z/reference/#call-step[reference]
 
+[[combine-step]]
+=== combine()
+
+*Description:* Appends one list to the other and returns the result to the 
Traversal Stream.
+
+*Syntax:* `combine(Object)`
+
+[width="100%",options="header"]
+|=
+|Start Step |Mid Step |Modulated |Domain |Range
+|N |Y |N |`array`/`Iterable` |`List`
+|=
+
+*Arguments:*
+
+* `Object` - A list of items (as an Iterable or an array) a traversal that 
will produce a list of items.

Review Comment:
   updated.





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778854#comment-17778854
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369372788


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TraversalMergeStep.java:
##
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the merger of the traverser and the provided 
arguments without duplicates. This is commonly
+ * known as a union.
+ */
+public final class TraversalMergeStep extends ScalarMapStep 
implements TraversalParent, ListFunction {
+private Traversal.Admin valueTraversal;
+private Object parameterItems;
+public TraversalMergeStep(final Traversal.Admin traversal, final Object 
values) {
+super(traversal);
+
+if (values instanceof Traversal) {
+valueTraversal = integrateChild(((Traversal) 
values).asAdmin());
+} else {
+parameterItems = values;
+}
+}
+
+@Override
+public String getStepName() { return "merge"; }
+
+@Override
+protected E map(final Traverser.Admin traverser) {
+S incoming = traverser.get();
+
+Map mapA = (incoming instanceof Map) ? (Map) incoming : null;
+if (mapA != null) {
+final Object mapB = (valueTraversal != null) ? 
TraversalUtil.apply(traverser, valueTraversal) : parameterItems;
+if (!(mapB instanceof Map)) {
+throw new IllegalArgumentException(
+String.format(
+"%s step expected provided argument to 
evaluate to a Map, encountered %s",
+getStepName(),
+mapB.getClass()));
+}
+
+final Map mergedMap = new HashMap(mapA);
+mergedMap.putAll((Map) mapB);
+return (E) mergedMap;
+} else {
+final Collection listA = convertTraverserToCollection(traverser);
+
+if (parameterItems instanceof Map) {
+throw new IllegalArgumentException(getStepName() + " step type 
mismatch: expected argument to be Iterable but got Map");
+}
+final Collection listB =
+(null != valueTraversal)
+? convertTraversalToCollection(traverser, 
valueTraversal)
+: convertArgumentToCollection(parameterItems);
+
+final Set elements = new HashSet();
+
+elements.addAll(listA);
+elements.addAll(listB);
+
+return (E) elements;
+}
+}
+
+@Override
+public List> getLocalChildren() {
+return (null == valueTraversal) ? Collections.emptyList() : 
Collections.singletonList(valueTraversal);
+}
+
+@Override
+public Set getRequirements() { return 
this.getSelfAndChildRequirements(); }
+
+@Override
+public void setTraversal(final Traversal.Admin parentTraversal) {
+super.setTraversal(parentTraversal);
+if 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778852#comment-17778852
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369372294


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##
@@ -1672,6 +1678,90 @@ public default GraphTraversal dateDiff(final 
Traversal dateTra
 return this.asAdmin().addStep(new DateDiffStep<>(this.asAdmin(), 
dateTraversal));
 }
 
+/**
+ * Calculates the difference between the list traverser and list argument.
+ *
+ * @return the traversal with an appended {@link DifferenceStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#difference-step;
 target="_blank">Reference Documentation - Difference Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> difference(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.difference, values);
+return this.asAdmin().addStep(new DifferenceStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Calculates the disjunction between the list traverser and list argument.
+ *
+ * @return the traversal with an appended {@link DisjunctStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#disjunct-step;
 target="_blank">Reference Documentation - Disjunct Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> disjunct(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.disjunct, values);
+return this.asAdmin().addStep(new DisjunctStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Calculates the intersection between the list traverser and list 
argument.
+ *
+ * @return the traversal with an appended {@link IntersectStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#intersect-step;
 target="_blank">Reference Documentation - Intersect Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> intersect(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.intersect, values);
+return this.asAdmin().addStep(new IntersectStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Joins together the elements of the incoming list traverser together 
with the provided delimiter.
+ *
+ * @return the traversal with an appended {@link ConjoinStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#join-step; 
target="_blank">Reference Documentation - Join Step

Review Comment:
   updated.





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778851#comment-17778851
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

kenhuuu commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369372021


##
docs/src/reference/the-traversal.asciidoc:
##
@@ -3759,12 +3885,14 @@ 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gre
 [[reverse-step]]
 === Reverse Step
 
-The `reverse()`-step (*map*) returns a reversed string of the incoming string 
traverser. Null values are not processed and remain
-as null when returned. If the incoming traverser is a non-String value then an 
`IllegalArgumentException` will be thrown.
+The `reverse()`-step (*map*) returns a reversed of the incoming list 
traverser. Single values (including null) are not
+processed and are added back to the Traversal Stream unchanged. If the 
incoming traverser is a String value then the
+reversed String will be returned.
 
 [gremlin-groovy,modern]
 
 g.V().values("name").reverse()
+g.V().values("name").fold().reverse()

Review Comment:
   Done.



##
docs/src/upgrade/release-3.7.x.asciidoc:
##
@@ -225,11 +226,34 @@ gremlin> g.V().values("age").fold().all(P.gt(10))
 ==>[29,27,32,35]
 gremlin> g.V().values("age").fold().any(P.eq(32))
 ==>[29,27,32,35]
+gremlin> 
g.V().values("age").fold().product(__.V().values("age").limit(2).fold())
+==>[[29,29],[29,27],[27,29],[27,27],[32,29],[32,27],[35,29],[35,27]]
+gremlin> g.V().values("age").fold().merge([32,30,50])
+==>[32,50,35,27,29,30]
+gremlin> g.V().values("age").fold().combine([32,30,50])
+==>[29,27,32,35,32,30,50]
+gremlin> g.V().values("age").fold().intersect([32,30,50])
+==>[32]
+gremlin> g.V().values("age").fold().disjunct([32,30,50])
+==>[50,35,27,29,30]
+gremlin> g.V().values("age").fold().difference([32,30,50])
+==>[35,27,29]
+gremlin> g.V().values("age").order().by(desc).fold().reverse()
+==>[27,29,32,35]
+gremlin> g.V().values("age").fold().join("-")

Review Comment:
   conjoin. updated.





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2334) Add format() step

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778849#comment-17778849
 ] 

ASF GitHub Bot commented on TINKERPOP-2334:
---

vkagamlyk opened a new pull request, #2307:
URL: https://github.com/apache/tinkerpop/pull/2307

   Provide for a format() step which will handle result formatting to string 
values.
   
   https://issues.apache.org/jira/browse/TINKERPOP-2334




> Add format() step
> -
>
> Key: TINKERPOP-2334
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2334
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: process
>Affects Versions: 3.4.4
>Reporter: Stephen Mallette
>Priority: Major
>
> Provide for a {{format()}} step which will handle result formatting to string 
> values. This change will help resolve the need for string concatenation 
> functions while providing a lot of flexibility to how results can be formed:
> {code}
> gremlin> g.V().hasLabel('person').format("%{n} is %{a} years old.").by('n',
> 'name').by('a', 'age')
> ==>marko is 29 years old.
> ==>vadas is 27 years old.
> ==>josh is 32 years old.
> ==>peter is 35 years old.
> gremlin> g.V().hasLabel('person').format("%{name} is %{age} years old.")
> ==>marko is 29 years old.
> ==>vadas is 27 years old.
> ==>josh is 32 years old.
> ==>peter is 35 years old.
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-3008) Update concat() to accept traversal varargs and remove special treatment of inject child traversals

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778845#comment-17778845
 ] 

ASF GitHub Bot commented on TINKERPOP-3008:
---

xiazcy merged PR #2306:
URL: https://github.com/apache/tinkerpop/pull/2306




> 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)


[jira] [Created] (TINKERPOP-3009) SubgraphStrategy produces excessive filtering when multiple labels are filtered upon

2023-10-23 Thread Brian O'Keefe (Jira)
Brian O'Keefe created TINKERPOP-3009:


 Summary: SubgraphStrategy produces excessive filtering when 
multiple labels are filtered upon
 Key: TINKERPOP-3009
 URL: https://issues.apache.org/jira/browse/TINKERPOP-3009
 Project: TinkerPop
  Issue Type: Bug
Affects Versions: 3.6.2
Reporter: Brian O'Keefe


See the example profile below.  Notice the traversal includes _has _filters 
everywhere repeatedly applied for vertices which are already filtered before 
too.

{noformat}
gremlin> g.withStrategies(SubgraphStrategy.build().
..1>vertices(hasLabel('x','y','z')).create()).
..2>   V().out().profile()
==>Traversal Metrics
Step   Count  
Traversers   Time (ms)% Dur
=
TinkerGraphStep(vertex,[~label.within([x, y, z])])  
   0.16058.50
VertexStep(OUT,edge)
   0.017 6.53
AndStep([[EdgeVertexStep(IN), HasStep([~label.w...  
   0.017 6.19
  EdgeVertexStep(IN)
   0.000
  HasStep([~label.within([x, y, z])])   
   0.000
  EdgeVertexStep(OUT)   
   0.000
  HasStep([~label.within([x, y, z])])   
   0.000
EdgeVertexStep(IN)  
   0.06423.59
HasStep([~label.within([x, y, z])]) 
   0.014 5.18
>TOTAL -
   -   0.274-
{noformat}





--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-3008) Update concat() to accept traversal varargs and remove special treatment of inject child traversals

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778814#comment-17778814
 ] 

ASF GitHub Bot commented on TINKERPOP-3008:
---

kenhuuu commented on PR #2306:
URL: https://github.com/apache/tinkerpop/pull/2306#issuecomment-1775944519

   VOTE +1




> 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)


[jira] [Commented] (TINKERPOP-3008) Update concat() to accept traversal varargs and remove special treatment of inject child traversals

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-3008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)


[jira] [Created] (TINKERPOP-3008) Update concat() to accept traversal varargs and remove special treatment of inject child traversals

2023-10-23 Thread Yang Xia (Jira)
Yang Xia created TINKERPOP-3008:
---

 Summary: 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


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)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778767#comment-17778767
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

xiazcy commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369007819


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/CombineStep.java:
##
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the combination of the traverser and the provided 
arguments. This is also commonly known as
+ * concatenation or append.
+ */
+public final class CombineStep extends ScalarMapStep> 
implements TraversalParent, ListFunction {
+private Traversal.Admin valueTraversal;
+private Object parameterItems;
+
+public CombineStep(final Traversal.Admin traversal, final Object values) {
+super(traversal);
+
+if (values instanceof Traversal) {
+valueTraversal = integrateChild(((Traversal) 
values).asAdmin());
+} else {
+parameterItems = values;
+}
+}
+
+@Override
+public String getStepName() { return "combine"; }
+
+@Override
+protected List map(Traverser.Admin traverser) {
+final Collection listA = convertTraverserToCollection(traverser);
+final Collection listB = (null != valueTraversal) ? 
convertTraversalToCollection(traverser, valueTraversal) : 
convertArgumentToCollection(parameterItems);
+
+final List combined = new ArrayList(listA);
+combined.addAll(listB);
+
+return combined;
+}
+
+@Override
+public List> getLocalChildren() {
+return (null == valueTraversal) ? Collections.emptyList() : 
Collections.singletonList(valueTraversal);
+}
+
+@Override
+public Set getRequirements() { return 
this.getSelfAndChildRequirements(); }

Review Comment:
   I think you'd want to pass in the requirement for the self too?
   ```suggestion
   public Set getRequirements() { return 
this.getSelfAndChildRequirements(TraverserRequirement.OBJECT); }
   ```





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778764#comment-17778764
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1369004507


##
gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/Combine.feature:
##
@@ -0,0 +1,240 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+@StepClassMap @StepCombine
+Feature: Step - combine()
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_injectXnullX_combineXinjectX1XX
+Given the empty graph
+And the traversal of
+  """
+  g.inject(null).combine(__.inject(1))
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"Incoming traverser for combine step can't be null"
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_V_valuesXnameX_combineXV_foldX
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("name").combine(__.V().fold())
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"combine step can only take an array or an Iterable type for incoming 
traversers"
+
+  Scenario: g_V_fold_combineXconstantXnullXX
+Given the modern graph
+And the traversal of
+  """
+  g.V().fold().combine(__.constant(null))
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"traversal argument for combine step must yield an iterable type, not null"
+
+  @GraphComputerVerificationMidVNotSupported
+  Scenario: g_V_fold_combineXVX
+Given the modern graph
+And the traversal of
+  """
+  g.V().fold().combine(__.V())
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"traversal argument for combine step must yield an iterable type, encountered"
+
+  Scenario: g_V_valuesXnameX_fold_combineX2X
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("name").fold().combine(2)
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"combine step can only take an array or an Iterable as an argument, encountered"
+
+  Scenario: g_V_valuesXnameX_fold_combineXnullX
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("name").fold().combine(null)
+  """
+When iterated to list
+Then the traversal will raise an error with message containing text of 
"Argument provided for combine step can't be null"
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_V_valuesXnonexistantX_fold_combineXV_valuesXnameX_foldX
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("nonexistant").fold().combine(__.V().values("name").fold())
+  """
+When iterated to list
+Then the result should be unordered
+  | result |
+  | l[marko,vadas,lop,josh,ripple,peter] |
+
+  @GraphComputerVerificationInjectionNotSupported
+  Scenario: g_V_valuesXnameX_fold_combineXV_valuesXnonexistantX_foldX
+Given the modern graph
+And the traversal of
+  """
+  g.V().values("name").fold().combine(__.V().values("nonexistant").fold())
+  """
+When iterated to list
+Then the result should be unordered
+  | result |
+  | l[marko,vadas,lop,josh,ripple,peter] |
+
+  @GraphComputerVerificationInjectionNotSupported

Review Comment:
   For some tests this tag is redundant





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778759#comment-17778759
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

Cole-Greer commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1367395931


##
docs/src/dev/provider/gremlin-semantics.asciidoc:
##
@@ -725,6 +725,42 @@ 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/o
 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/service/ServiceRegistry.java[ServiceRegistry],
 link:https://tinkerpop.apache.org/docs/x.y.z/reference/#call-step[reference]
 
+[[combine-step]]
+=== combine()
+
+*Description:* Appends one list to the other and returns the result to the 
Traversal Stream.
+
+*Syntax:* `combine(Object)`
+
+[width="100%",options="header"]
+|=
+|Start Step |Mid Step |Modulated |Domain |Range
+|N |Y |N |`array`/`Iterable` |`List`
+|=
+
+*Arguments:*
+
+* `Object` - A list of items (as an Iterable or an array) a traversal that 
will produce a list of items.

Review Comment:
   ```suggestion
   * `Object` - A list of items (as an Iterable or an array), or a traversal 
that will produce a list of items.
   ```



##
docs/src/dev/provider/gremlin-semantics.asciidoc:
##
@@ -725,6 +725,42 @@ 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/o
 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/service/ServiceRegistry.java[ServiceRegistry],
 link:https://tinkerpop.apache.org/docs/x.y.z/reference/#call-step[reference]
 
+[[combine-step]]
+=== combine()
+
+*Description:* Appends one list to the other and returns the result to the 
Traversal Stream.
+
+*Syntax:* `combine(Object)`
+
+[width="100%",options="header"]
+|=
+|Start Step |Mid Step |Modulated |Domain |Range
+|N |Y |N |`array`/`Iterable` |`List`
+|=
+
+*Arguments:*
+
+* `Object` - A list of items (as an Iterable or an array) a traversal that 
will produce a list of items.
+
+*Modulation:*
+
+None
+
+*Considerations:*
+
+A list is returned after the combine operation is applied so duplicates are 
allowed. `Merge` can be used instead if
+duplicates aren't wanted. This step only applies to list types which means 
that non-iterable types (including null)
+will cause exceptions to be thrown.
+
+*Exceptions*
+
+* If the incoming traverser isn't a list (array or Iterable) then an 
`IllegalArgumentException` will be thrown.
+* If the argument doesn't resolve to a list (array or Iterable) then an 
`IllegalArgumentException` will be thrown.
+
+See: 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/CombineStep.java[source],
+link:https://tinkerpop.apache.org/docs/x.y.z/reference/#combine-step[reference],
+link:https://tinkerpop.apache.org/docs/x.y.z/reference/#merge-step[reference],

Review Comment:
   Is the link to the merge reference docs intended here? If so can we change 
the hyperlink name to something else such as:
   ```suggestion
   link:https://tinkerpop.apache.org/docs/x.y.z/reference/#merge-step[merge() 
reference]
   ```



##
docs/src/reference/the-traversal.asciidoc:
##
@@ -1140,6 +1140,24 @@ g.V().coin(1.0)
 
 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#coin-double-++[`coin(double)`]
 
+[[combine-step]]
+=== Combine Step
+
+The `combine()`-step (*map*) combines the elements of the incoming list 
traverser and the provided list argument into
+one list. This is also known as appending or concatenating. This step only 
expects list data (array or Iterable) and
+will throw an `IllegalArgumentException` if any other type is encountered 
(including null). This differs from the
+`merge` step in that it allows duplicates to exist.
+
+[gremlin-groovy,modern]
+
+g.V().values("name").fold().combine(["james","jen","marko","vadas"])

Review Comment:
   Could you add one example for each step which uses a child traversal as the 
argument? It would be good to showcase that capability as well.





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778755#comment-17778755
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368990078


##
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConjoinStepTest.java:
##
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.StepTest;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+public class ConjoinStepTest extends StepTest {
+@Override
+protected List getTraversals() { return 
Collections.singletonList(__.conjoin("a")); }
+
+@Test
+public void testReturnTypes() {
+try {
+__.__(Collections.emptyList()).conjoin(null).next();

Review Comment:
   nit
   ```suggestion
   __.__(Collections.emptyList()).conjoin(null).next();
   fail();
   ```





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778752#comment-17778752
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368982131


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TraversalMergeStep.java:
##
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the merger of the traverser and the provided 
arguments without duplicates. This is commonly
+ * known as a union.
+ */
+public final class TraversalMergeStep extends ScalarMapStep 
implements TraversalParent, ListFunction {
+private Traversal.Admin valueTraversal;
+private Object parameterItems;
+public TraversalMergeStep(final Traversal.Admin traversal, final Object 
values) {
+super(traversal);
+
+if (values instanceof Traversal) {
+valueTraversal = integrateChild(((Traversal) 
values).asAdmin());
+} else {
+parameterItems = values;
+}
+}
+
+@Override
+public String getStepName() { return "merge"; }
+
+@Override
+protected E map(final Traverser.Admin traverser) {
+S incoming = traverser.get();
+
+Map mapA = (incoming instanceof Map) ? (Map) incoming : null;
+if (mapA != null) {
+final Object mapB = (valueTraversal != null) ? 
TraversalUtil.apply(traverser, valueTraversal) : parameterItems;
+if (!(mapB instanceof Map)) {
+throw new IllegalArgumentException(
+String.format(
+"%s step expected provided argument to 
evaluate to a Map, encountered %s",
+getStepName(),
+mapB.getClass()));
+}
+
+final Map mergedMap = new HashMap(mapA);
+mergedMap.putAll((Map) mapB);
+return (E) mergedMap;
+} else {
+final Collection listA = convertTraverserToCollection(traverser);
+
+if (parameterItems instanceof Map) {
+throw new IllegalArgumentException(getStepName() + " step type 
mismatch: expected argument to be Iterable but got Map");
+}
+final Collection listB =
+(null != valueTraversal)
+? convertTraversalToCollection(traverser, 
valueTraversal)
+: convertArgumentToCollection(parameterItems);
+
+final Set elements = new HashSet();
+
+elements.addAll(listA);
+elements.addAll(listB);
+
+return (E) elements;
+}
+}
+
+@Override
+public List> getLocalChildren() {
+return (null == valueTraversal) ? Collections.emptyList() : 
Collections.singletonList(valueTraversal);
+}
+
+@Override
+public Set getRequirements() { return 
this.getSelfAndChildRequirements(); }
+
+@Override
+public void setTraversal(final Traversal.Admin parentTraversal) {
+super.setTraversal(parentTraversal);
+if 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778751#comment-17778751
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368980624


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TraversalMergeStep.java:
##
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the merger of the traverser and the provided 
arguments without duplicates. This is commonly
+ * known as a union.
+ */
+public final class TraversalMergeStep extends ScalarMapStep 
implements TraversalParent, ListFunction {
+private Traversal.Admin valueTraversal;
+private Object parameterItems;
+public TraversalMergeStep(final Traversal.Admin traversal, final Object 
values) {
+super(traversal);
+
+if (values instanceof Traversal) {
+valueTraversal = integrateChild(((Traversal) 
values).asAdmin());
+} else {
+parameterItems = values;
+}
+}
+
+@Override
+public String getStepName() { return "merge"; }
+
+@Override
+protected E map(final Traverser.Admin traverser) {
+S incoming = traverser.get();

Review Comment:
   nit: `final`





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778744#comment-17778744
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368965002


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ConjoinStep.java:
##
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.process.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.process.traversal.util.ListFunction;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * A map step that returns the result of joining every element in the 
traverser using the delimiter argument.
+ */
+public final class ConjoinStep extends ScalarMapStep implements 
ListFunction {

Review Comment:
   do we need to override `toString()` for some steps?





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778738#comment-17778738
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368952470


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##
@@ -1672,6 +1678,90 @@ public default GraphTraversal dateDiff(final 
Traversal dateTra
 return this.asAdmin().addStep(new DateDiffStep<>(this.asAdmin(), 
dateTraversal));
 }
 
+/**
+ * Calculates the difference between the list traverser and list argument.
+ *
+ * @return the traversal with an appended {@link DifferenceStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#difference-step;
 target="_blank">Reference Documentation - Difference Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> difference(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.difference, values);
+return this.asAdmin().addStep(new DifferenceStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Calculates the disjunction between the list traverser and list argument.
+ *
+ * @return the traversal with an appended {@link DisjunctStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#disjunct-step;
 target="_blank">Reference Documentation - Disjunct Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> disjunct(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.disjunct, values);
+return this.asAdmin().addStep(new DisjunctStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Calculates the intersection between the list traverser and list 
argument.
+ *
+ * @return the traversal with an appended {@link IntersectStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#intersect-step;
 target="_blank">Reference Documentation - Intersect Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> intersect(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.intersect, values);
+return this.asAdmin().addStep(new IntersectStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Joins together the elements of the incoming list traverser together 
with the provided delimiter.
+ *
+ * @return the traversal with an appended {@link ConjoinStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#join-step; 
target="_blank">Reference Documentation - Join Step

Review Comment:
   `join` is not replaced with `conjoin`





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778737#comment-17778737
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368952470


##
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##
@@ -1672,6 +1678,90 @@ public default GraphTraversal dateDiff(final 
Traversal dateTra
 return this.asAdmin().addStep(new DateDiffStep<>(this.asAdmin(), 
dateTraversal));
 }
 
+/**
+ * Calculates the difference between the list traverser and list argument.
+ *
+ * @return the traversal with an appended {@link DifferenceStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#difference-step;
 target="_blank">Reference Documentation - Difference Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> difference(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.difference, values);
+return this.asAdmin().addStep(new DifferenceStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Calculates the disjunction between the list traverser and list argument.
+ *
+ * @return the traversal with an appended {@link DisjunctStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#disjunct-step;
 target="_blank">Reference Documentation - Disjunct Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> disjunct(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.disjunct, values);
+return this.asAdmin().addStep(new DisjunctStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Calculates the intersection between the list traverser and list 
argument.
+ *
+ * @return the traversal with an appended {@link IntersectStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#intersect-step;
 target="_blank">Reference Documentation - Intersect Step
+ * @since 3.7.1
+ */
+public default GraphTraversal> intersect(final Object values) {
+this.asAdmin().getBytecode().addStep(Symbols.intersect, values);
+return this.asAdmin().addStep(new IntersectStep<>(this.asAdmin(), 
values));
+}
+
+/**
+ * Joins together the elements of the incoming list traverser together 
with the provided delimiter.
+ *
+ * @return the traversal with an appended {@link ConjoinStep}.
+ * @see http://tinkerpop.apache.org/docs/${project.version}/reference/#join-step; 
target="_blank">Reference Documentation - Join Step

Review Comment:
   `join` not replaced with `conjoin`





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Closed] (TINKERPOP-2811) ElementIdStrategy doesn't replace all references of an element's id with the specified custom id property

2023-10-23 Thread Stephen Mallette (Jira)


 [ 
https://issues.apache.org/jira/browse/TINKERPOP-2811?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephen Mallette closed TINKERPOP-2811.
---
Fix Version/s: 3.6.6
   3.7.1
 Assignee: Stephen Mallette
   Resolution: Fixed

> ElementIdStrategy doesn't replace all references of an element's id with the 
> specified custom id property
> -
>
> Key: TINKERPOP-2811
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2811
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.4.0, 3.6.1
>Reporter: Cameron Smith
>Assignee: Stephen Mallette
>Priority: Minor
> Fix For: 3.6.6, 3.7.1
>
>
> When using the ElementIdStrategy, if a traversal attempts to filter graph 
> elements with multiple _has_ steps and the id filter is not the first 
> property to be filtered on, then the reference to the element's id is not 
> replaced with the custom id property during the ElementIdStrategy's mutation 
> of the traversal:
> {noformat}
> gremlin> graph = TinkerGraph.open()
> ==>tinkergraph[vertices:0 edges:0]
> gremlin> g = 
> graph.traversal().withStrategies(ElementIdStrategy.build().create())
> ==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
> gremlin> g.V().hasId("foo").has("name", "bar").explain()
> ==>Traversal Explanation
> ===
> Original Traversal                    [GraphStep(vertex,[]), 
> HasStep([~id.eq(foo), name.eq(bar)])]
> ConnectiveStrategy              [D]   [GraphStep(vertex,[]), 
> HasStep([~id.eq(foo), name.eq(bar)])]
> ElementIdStrategy               [D]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> IdentityRemovalStrategy         [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> MatchPredicateStrategy          [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> FilterRankingStrategy           [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> InlineFilterStrategy            [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> IncidentToAdjacentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> AdjacentToIncidentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> EarlyLimitStrategy              [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> ByModulatorOptimizationStrategy [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> RepeatUnrollStrategy            [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> CountStrategy                   [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> PathRetractionStrategy          [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> LazyBarrierStrategy             [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> TinkerGraphCountStrategy        [P]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> TinkerGraphStepStrategy         [P]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> TinkerMergeEVStepStrategy       [P]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> ProfileStrategy                 [F]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> StandardVerificationStrategy    [V]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> Final Traversal                       [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> gremlin> g.V().has("name", "bar").hasId("foo").explain()
> ==>Traversal Explanation
> ==
> Original Traversal                    [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> ConnectiveStrategy              [D]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> ElementIdStrategy               [D]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> IdentityRemovalStrategy         [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> MatchPredicateStrategy          [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> FilterRankingStrategy           [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> InlineFilterStrategy            [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> IncidentToAdjacentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> AdjacentToIncidentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778734#comment-17778734
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368947896


##
docs/src/upgrade/release-3.7.x.asciidoc:
##
@@ -225,11 +226,34 @@ gremlin> g.V().values("age").fold().all(P.gt(10))
 ==>[29,27,32,35]
 gremlin> g.V().values("age").fold().any(P.eq(32))
 ==>[29,27,32,35]
+gremlin> 
g.V().values("age").fold().product(__.V().values("age").limit(2).fold())
+==>[[29,29],[29,27],[27,29],[27,27],[32,29],[32,27],[35,29],[35,27]]
+gremlin> g.V().values("age").fold().merge([32,30,50])
+==>[32,50,35,27,29,30]
+gremlin> g.V().values("age").fold().combine([32,30,50])
+==>[29,27,32,35,32,30,50]
+gremlin> g.V().values("age").fold().intersect([32,30,50])
+==>[32]
+gremlin> g.V().values("age").fold().disjunct([32,30,50])
+==>[50,35,27,29,30]
+gremlin> g.V().values("age").fold().difference([32,30,50])
+==>[35,27,29]
+gremlin> g.V().values("age").order().by(desc).fold().reverse()
+==>[27,29,32,35]
+gremlin> g.V().values("age").fold().join("-")

Review Comment:
   `join` or `conjoin`?





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (TINKERPOP-2811) ElementIdStrategy doesn't replace all references of an element's id with the specified custom id property

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778733#comment-17778733
 ] 

ASF GitHub Bot commented on TINKERPOP-2811:
---

spmallette merged PR #2293:
URL: https://github.com/apache/tinkerpop/pull/2293




> ElementIdStrategy doesn't replace all references of an element's id with the 
> specified custom id property
> -
>
> Key: TINKERPOP-2811
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2811
> Project: TinkerPop
>  Issue Type: Bug
>  Components: process
>Affects Versions: 3.4.0, 3.6.1
>Reporter: Cameron Smith
>Priority: Minor
>
> When using the ElementIdStrategy, if a traversal attempts to filter graph 
> elements with multiple _has_ steps and the id filter is not the first 
> property to be filtered on, then the reference to the element's id is not 
> replaced with the custom id property during the ElementIdStrategy's mutation 
> of the traversal:
> {noformat}
> gremlin> graph = TinkerGraph.open()
> ==>tinkergraph[vertices:0 edges:0]
> gremlin> g = 
> graph.traversal().withStrategies(ElementIdStrategy.build().create())
> ==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
> gremlin> g.V().hasId("foo").has("name", "bar").explain()
> ==>Traversal Explanation
> ===
> Original Traversal                    [GraphStep(vertex,[]), 
> HasStep([~id.eq(foo), name.eq(bar)])]
> ConnectiveStrategy              [D]   [GraphStep(vertex,[]), 
> HasStep([~id.eq(foo), name.eq(bar)])]
> ElementIdStrategy               [D]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> IdentityRemovalStrategy         [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> MatchPredicateStrategy          [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> FilterRankingStrategy           [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> InlineFilterStrategy            [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> IncidentToAdjacentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> AdjacentToIncidentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> EarlyLimitStrategy              [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> ByModulatorOptimizationStrategy [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> RepeatUnrollStrategy            [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> CountStrategy                   [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> PathRetractionStrategy          [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> LazyBarrierStrategy             [O]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> TinkerGraphCountStrategy        [P]   [GraphStep(vertex,[]), 
> HasStep([__id.eq(foo), name.eq(bar)])]
> TinkerGraphStepStrategy         [P]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> TinkerMergeEVStepStrategy       [P]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> ProfileStrategy                 [F]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> StandardVerificationStrategy    [V]   [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> Final Traversal                       [TinkerGraphStep(vertex,[__id.eq(foo), 
> name.eq(bar)])]
> gremlin> g.V().has("name", "bar").hasId("foo").explain()
> ==>Traversal Explanation
> ==
> Original Traversal                    [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> ConnectiveStrategy              [D]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> ElementIdStrategy               [D]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> IdentityRemovalStrategy         [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> MatchPredicateStrategy          [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> FilterRankingStrategy           [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> InlineFilterStrategy            [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> IncidentToAdjacentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> AdjacentToIncidentStrategy      [O]   [GraphStep(vertex,[]), 
> HasStep([name.eq(bar), ~id.eq(foo)])]
> EarlyLimitStrategy              [O]   [GraphStep(vertex,[]), 
> 

[jira] [Commented] (TINKERPOP-2978) Add List Manipulation Steps to Gremlin

2023-10-23 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17778732#comment-17778732
 ] 

ASF GitHub Bot commented on TINKERPOP-2978:
---

vkagamlyk commented on code in PR #2302:
URL: https://github.com/apache/tinkerpop/pull/2302#discussion_r1368944918


##
docs/src/reference/the-traversal.asciidoc:
##
@@ -3759,12 +3885,14 @@ 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gre
 [[reverse-step]]
 === Reverse Step
 
-The `reverse()`-step (*map*) returns a reversed string of the incoming string 
traverser. Null values are not processed and remain
-as null when returned. If the incoming traverser is a non-String value then an 
`IllegalArgumentException` will be thrown.
+The `reverse()`-step (*map*) returns a reversed of the incoming list 
traverser. Single values (including null) are not
+processed and are added back to the Traversal Stream unchanged. If the 
incoming traverser is a String value then the
+reversed String will be returned.
 
 [gremlin-groovy,modern]
 
 g.V().values("name").reverse()
+g.V().values("name").fold().reverse()

Review Comment:
   good to add <1>/<2> and explain difference





> Add List Manipulation Steps to Gremlin
> --
>
> Key: TINKERPOP-2978
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2978
> Project: TinkerPop
>  Issue Type: Improvement
>  Components: language
>Reporter: Cole Greer
>Priority: Major
>
> Today Gremlin requires that users fall back to closures to handle many common 
> list manipulation options that users want to do on data in the graph.  This 
> is a problem for many users as many of the providers prevent the use of 
> closures due to the security risks so for these users there is no way to 
> manipulate lists directly.
> A full list of proposed functions and semantics is detailed here: 
> https://github.com/apache/tinkerpop/blob/3.7.0/docs/src/dev/future/proposal-3-remove-closures.asciidoc



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Created] (TINKERPOP-3007) RequestOptions don't get passed over submit()

2023-10-23 Thread Stephen Mallette (Jira)
Stephen Mallette created TINKERPOP-3007:
---

 Summary: RequestOptions don't get passed over submit()
 Key: TINKERPOP-3007
 URL: https://issues.apache.org/jira/browse/TINKERPOP-3007
 Project: TinkerPop
  Issue Type: Improvement
  Components: driver
Affects Versions: 3.6.5
Reporter: Stephen Mallette


TinkerPop APIs allow this:

{code}
final Cluster cluster = test.createGremlinCluster();
final GraphTraversalSource g = 
traversal().withRemote(DriverRemoteConnection.using(cluster));
try {
client.submit(g.with("evaluationTimeout",1).

V("1").repeat(__.out().limit(1)).times(1000).constant(1)).all().get();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
cluster.close();
{code}

which bypasses functionality that injects the timeout and other 
{{RequestOptions}} into the request. Ultimately, this usage is undocumented but 
allowable without clear documentation saying otherwise. Deprecate this 
immediately, then come up with a proper means to remove it entirely in a major 
version where a breaking change can take place.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)