andreachild commented on code in PR #2919:
URL: https://github.com/apache/tinkerpop/pull/2919#discussion_r1863944257


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java:
##########
@@ -2388,14 +2879,39 @@ public default GraphTraversal<S, E> hasId(final Object 
id, final Object... other
                 // as ids are unrolled when it's in array, they should also be 
unrolled when it's a list.
                 // this also aligns with behavior of hasId() when it's pushed 
down to g.V() (TINKERPOP-2863)
                 ids.addAll((Collection<?>) id);
-            } else
+            } else {
                 ids.add(id);
+            }
 
             // unrolling ids from lists works cleaner with Collection too, as 
otherwise they will need to
             // be turned into array first
             if (otherIds != null) {
                 for (final Object i : otherIds) {
-                    if (id instanceof Object[]) {
+                    // to retain existing behavior, GValue's containing 
collections are unrolled by 1 layer.
+                    // For example, GValue.of([1, 2]) is processed to 
[GValue.of(1), GValue.of(2)]
+                    if(i instanceof GValue) {
+                        Object value = ((GValue) i).get();
+                        if (i instanceof Object[]) {
+                            for (Object o : (Object[]) value) {

Review Comment:
   Nit: can this loop be replaced with `ids.add(GValue.ensureGValues((Object[]) 
i));`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to