[ 
https://issues.apache.org/jira/browse/TINKERPOP-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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
+    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:
   updated tag.





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

Reply via email to