Skip to content

Add splitByElement() method for parsing nested list or set#3216

Closed
yunlingTao wants to merge 1 commit intoapache:3.8-devfrom
yunlingTao:split_by_element
Closed

Add splitByElement() method for parsing nested list or set#3216
yunlingTao wants to merge 1 commit intoapache:3.8-devfrom
yunlingTao:split_by_element

Conversation

@yunlingTao
Copy link
Copy Markdown

Added splitByElement() method in gremlin-test which splits strings without breaking elements containing commas inside brackets or braces.
It replaces split(",") in list and set parsing to handle structures like s[l[1,2,3], l[2,3,4]].

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 9, 2025

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (3.8-dev@470ba52). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...che/tinkerpop/gremlin/features/StepDefinition.java 80.95% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             3.8-dev    #3216   +/-   ##
==========================================
  Coverage           ?   76.77%           
  Complexity         ?    14942           
==========================================
  Files              ?     1159           
  Lines              ?    72502           
  Branches           ?     8041           
==========================================
  Hits               ?    55667           
  Misses             ?    13816           
  Partials           ?     3019           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return String.format("\"%s\"", pvalue);
}

private List<String> splitByElement(String s) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add a scenario to a feature test would would execute this new logic. Perhaps adding a scenario to the Fold.feature which does something like g.V().fold().fold() which will result in a list of lists?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do other GLVs need a similar change? For example the parsing logic for lists and sets in feature-steps.js and feature_steps.py.

spmallette added a commit that referenced this pull request Apr 8, 2026
…n parsing

Naive split(",") breaks on nested collection tokens like l[1,2,3] inside
s[l[1,2,3],l[4,5,6]]. Adds a bracket-depth-aware splitByElement() helper to
all Gherkin step definition files across Java and every GLV, so that commas
inside nested brackets are not treated as top-level separators.

Also adds two new Gherkin scenarios to Fold.feature that exercise nested
list-of-list results (g.inject([1,2],[3,4]).fold()), along with the
corresponding traversal bindings in each GLV's translation map.

Java implementation follows PR #3216.

(tinkerpop-mxr, tinkerpop-32y, tinkerpop-ghp, tinkerpop-2ur, tinkerpop-70k, tinkerpop-188, tinkerpop-93a)
@yunlingTao
Copy link
Copy Markdown
Author

Closing in favor of #3379 which extends this to all GLVs and adds Gherkin scenarios.

@yunlingTao yunlingTao closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants