This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e9483e7c2 Specify project() by()/key count mismatch semantics
9e9483e7c2 is described below

commit 9e9483e7c2386c75a6ea4f55d3062f7ee3bb320c
Author: Stephen Mallette <[email protected]>
AuthorDate: Fri Sep 11 19:44:07 2026 +0000

    Specify project() by()/key count mismatch semantics
    
    The project() section stated only that the number of by() modulations
    should match the number of keys, without describing what happens when
    they do not. Replace that soft guidance with the concrete, no-error
    behavior: fewer by() modulations than keys are reused cyclically in
    round-robin order, surplus by() modulations are silently ignored, and
    with no by() every key maps to the current object unchanged.
    
    Assisted-by: Kiro:claude-opus-4.8
---
 docs/src/dev/provider/gremlin-semantics.asciidoc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/docs/src/dev/provider/gremlin-semantics.asciidoc 
b/docs/src/dev/provider/gremlin-semantics.asciidoc
index 1ff86fd38f..18034f9e4a 100644
--- a/docs/src/dev/provider/gremlin-semantics.asciidoc
+++ b/docs/src/dev/provider/gremlin-semantics.asciidoc
@@ -2816,8 +2816,9 @@ 
link:https://tinkerpop.apache.org/docs/x.y.z/reference/#product-step[reference]
 
 *Modulation:*
 
-* `by()` - Determines how to transform the current object for each key in the 
resulting map. The number of `by()`
-modulations should match the number of keys provided.
+* `by()` - Determines how to transform the current object for each key in the 
resulting map. The `by()` modulations
+are matched to the keys in the order both are provided. A mismatch between the 
number of `by()` modulations and the
+number of keys does not raise an error and is resolved as described in the 
considerations below.
 
 *Considerations:*
 
@@ -2826,6 +2827,12 @@ current state of the traverser. Each key in the 
resulting map corresponds to a `
 provided. If a `by()` modulation doesn't produce a value for a particular key 
(not productive), that key will be omitted
 from the resulting `MAP`.
 
+The number of `by()` modulations need not equal the number of keys, and any 
mismatch is resolved without raising an
+error. When fewer `by()` modulations than keys are provided, the modulations 
are reused cyclically across the keys in
+round-robin order, so a single `by()` is applied to every key. When more 
`by()` modulations than keys are provided, the
+surplus modulations are never consumed and are silently ignored. When no 
`by()` modulation is provided, every key maps
+to the current object unchanged.
+
 *Exceptions:*
 
 * If duplicate keys are provided, an `Argument Error` is raised.

Reply via email to