You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by "vkagamlyk (via GitHub)" <gi...@apache.org> on 2023/04/13 20:02:01 UTC

[GitHub] [tinkerpop] vkagamlyk commented on a diff in pull request #2012: [TINKERPOP-2890] Avoid exceptions on local scope based steps where possible

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


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/TailLocalStep.java:
##########
@@ -54,7 +54,7 @@ protected S map(final Traverser.Admin<S> traverser) {
                         start instanceof Collection ? ((Collection) start).size() :
                                 start instanceof Path ? ((Path) start).size() :
                                         start instanceof Iterable ? IteratorUtils.count((Iterable) start) :
-                                                this.limit;
+                                                IteratorUtils.count(IteratorUtils.asIterator(start));

Review Comment:
   also to handle arrays as input
   ```
   gremlin> g.inject([1,2,3] as int[], [1]).tail(local,1)
   ==>[1, 2, 3]
   ==>1
   ```



-- 
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: commits-unsubscribe@tinkerpop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org