TINKERPOP-3270 where(P) throws a descriptive error for non-String scope keys#3559
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 3.7-dev #3559 +/- ##
=============================================
+ Coverage 75.49% 75.52% +0.02%
- Complexity 13161 13183 +22
=============================================
Files 1092 1093 +1
Lines 67208 67249 +41
Branches 7391 7397 +6
=============================================
+ Hits 50742 50792 +50
Misses 13837 13837
+ Partials 2629 2620 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xiazcy
reviewed
Jul 23, 2026
Contributor
|
VOTE +1 pending comment resolution |
Assisted-by: Kiro: Claude Opus 4.8
Contributor
|
VOTE +1, merging as CTR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
where(P)expects aStringscope key (e.g.where(eq('a'))). Given a non-Stringpredicate value like
gt(5),WherePredicateStepcast it toStringunconditionally,throwing a raw
ClassCastExceptionat step construction. This change validates thevalue first and throws a descriptive
IllegalArgumentExceptionpointing tois(P)forvalue comparisons. Backward-compatible diagnostics fix; valid queries are unaffected.
Before vs After
Non-String (numeric) predicate value
ClassCastException: class java.lang.Integer cannot be cast to class java.lang.StringIllegalArgumentException: where(P) requires a String scope key but encountered Integer; use is(P) to compare valuesNested inside a parent
where(Traversal)ClassCastException, buried in a nested traversalIllegalArgumentExceptionpointing tois(P)Correct usage (unchanged)
Changes
gremlin-core: runtimeStringvalidation inWherePredicateStep.getSelectKey(...)gremlin-test: negative tests added to theWhereTestsuite (the exception is thrown at step construction, so they pass across all engines)CHANGELOG.asciidoc: entry under 3.7.7Assisted-by: Kiro: Claude Opus 4.8