[refactor](inverted-index) replace void* query_value with typed paraminterface#62960
Open
csun5285 wants to merge 1 commit intoapache:masterfrom
Open
[refactor](inverted-index) replace void* query_value with typed paraminterface#62960csun5285 wants to merge 1 commit intoapache:masterfrom
csun5285 wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
6839dd5 to
a842dba
Compare
… interface
Production query path no longer carries a const void* + reinterpret_cast
through InvertedIndexReader::query / try_query. Three classes with
distinct responsibilities replace the old conflated InvertedIndexQueryParamFactory:
* InvertedIndexQueryParam — abstract value interface; readers
pull the value via typed virtuals
(get_string / encode_ascending /
encode_min_ascending /
encode_max_ascending).
* TypedInvertedIndexQueryParam<PT> — concrete typed value; numeric/
date/decimal/IP specialisation
implements the encode_* virtuals
using type_limit<>; string
specialisation implements
get_string only.
* InvertedIndexQueryParamFactory — static-only namespace class that
maps FE values onto the correct
TypedInvertedIndexQueryParam<PT>;
no instances, no inheritance.
BkdIndexReader::construct_bkd_query_value drops the std::vector<char>
tmp scratch buffer and the _type_info->set_to_min/max calls used to
synthesize +/-infinity sentinels for half-bounded range queries. The
sentinel is now produced directly by the typed query value
(encode_min_ascending / encode_max_ascending), so only inverted-index
supported types ever need to know how to emit a min/max.
With BKD no longer the only consumer, the entire TypeInfo::set_to_min/max
API surface is removed: TypeInfo virtuals, ScalarTypeInfo storage,
List/Map/Struct DCHECK-fail overrides, every FieldTypeTraits<...>
specialization, the OLAP_FIELD_TYPE_CHAR static function pointer in
types.cpp, Field::set_to_min/max wrappers, and the CharField/VarcharField
/StringField overrides. Corresponding storage_types_test cases are removed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a842dba to
5fee30d
Compare
Contributor
Author
|
run buildall |
yiguolei
reviewed
Apr 30, 2026
|
|
||
| // DATE storage. Packed as `year<<9 | month<<5 | day`: 33=0001-01-01, 5119903=9999-12-31. | ||
| template <> | ||
| struct type_limit<uint24_t> { |
Contributor
There was a problem hiding this comment.
我们这个typelimit 的参数为什么不是datev1 这种类型,而是Uint24?
yiguolei
reviewed
Apr 30, 2026
| // TYPE_DATETIME: PrimitiveTypeTraits=uint64_t but KeyCoder=int64_t. With | ||
| // uint64_t, type_limit::max() = UINT64_MAX is read as -1 and encodes | ||
| // smaller than any real datetime — broken +inf. | ||
| using storage_val = std::conditional_t<PT == TYPE_DATETIME, int64_t, |
Contributor
There was a problem hiding this comment.
这个你讲清楚来龙去卖,就说之前有一个地方用的,现在改不了了
Contributor
Author
There was a problem hiding this comment.
这个地方就是KeyCoder=int64_t
Contributor
Author
There was a problem hiding this comment.
哦对,这里得索引用了keycoder
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.
What problem does this PR solve?
A typed query-param interface replaces the void*:
produces the correct +inf byte string.
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)