-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Enhancement] optimize variant seek path #67281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] optimize variant seek path #67281
Conversation
Signed-off-by: yan zhang <[email protected]>
Signed-off-by: yan zhang <[email protected]>
Signed-off-by: yan zhang <[email protected]>
| return Status::OK(); | ||
| }, | ||
| segment)); | ||
| if (current.is_null()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast break if it's null value.
| } | ||
| } else { | ||
| // non-unique dictionary, find all matching indexes | ||
| } else if (hint == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint = 0 means just return the first index
otherwise it means to search from this index.
| RETURN_IF_ERROR(search(0)); | ||
|
|
||
| // don't find key in the dict, then return null value. | ||
| if (dict_indexes.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is no dict index found, we don't return error, but return null value.
remember this case is not a abnormal case.
| std::string_view raw() const { return _value; } | ||
| VariantType type() const; | ||
| VariantType type() const { | ||
| switch (basic_type()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline this method.
| inline const char* assemble_state(TStatusCode::type code, std::string_view msg, std::string_view ctx) { | ||
| DCHECK(code != TStatusCode::OK); | ||
|
|
||
| if (msg.empty() && ctx.empty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast initialization
Signed-off-by: yan zhang <[email protected]>
9ce2a4c to
f345716
Compare
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 3 / 3 (100.00%) file detail
|
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
Why I'm doing:
What I'm doing:
These optimizations reduce overhead by:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
Note
Improves Variant path/object/array navigation performance and semantics, plus a small Status optimization.
VariantMetadata::_get_indexto minimize scans for non-unique dicts; refactorget_object_by_keyto leverage hints and returnnullwhen key not found instead of errorsget_element_at_indexnow returnsnullfor out-of-bounds indices (was error);VariantPath::seekshort-circuits when current segment resolves tonullVariantValue::type()intovariant.hand addis_null()for fast checksStatusstate assembly for empty message/context pathNULL_TYPEinstead of errors for missing keys/OOB, and adjust SQL golden results to showNullwhere appropriateWritten by Cursor Bugbot for commit f345716. This will update automatically on new commits. Configure here.