-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Doris On ES]fix bug of query failed in doc_value_mode when fields have none value #3513
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -198,11 +198,12 @@ static Status get_float_value(const rapidjson::Value &col, PrimitiveType type, v | |||||
| return Status::OK(); | ||||||
| } | ||||||
|
|
||||||
| ScrollParser::ScrollParser() : | ||||||
| ScrollParser::ScrollParser(bool doc_value_mode) : | ||||||
| _scroll_id(""), | ||||||
| _total(0), | ||||||
| _size(0), | ||||||
| _line_index(0) { | ||||||
| _line_index(0), | ||||||
| _doc_value_mode(doc_value_mode) { | ||||||
| } | ||||||
|
|
||||||
| ScrollParser::~ScrollParser() { | ||||||
|
|
@@ -247,6 +248,16 @@ Status ScrollParser::parse(const std::string& scroll_result, bool exactly_once) | |||||
| } | ||||||
|
|
||||||
| VLOG(1) << "es_scan_reader parse scroll result: " << scroll_result; | ||||||
| if (!outer_hits_node.HasMember(FIELD_INNER_HITS)) { | ||||||
| // this is caused by query some columns which are not exit, e.g. | ||||||
| // A Index has fields: k1,k2,k3. and we put some rows into this Index (some fields dose NOT contain any data) | ||||||
| // e.g. | ||||||
| // put index/_doc/1 {"k2":"123"} | ||||||
| // put index/_doc/2 {"k3":"123} | ||||||
| // then we use sql `select k1 from table` | ||||||
| // what ES return is like this: {hits: {total:2} | ||||||
| return Status::OK(); | ||||||
| } | ||||||
| const rapidjson::Value &inner_hits_node = outer_hits_node[FIELD_INNER_HITS]; | ||||||
| if (!inner_hits_node.IsArray()) { | ||||||
| LOG(WARNING) << "exception maybe happend on es cluster, reponse:" << scroll_result; | ||||||
|
|
@@ -275,7 +286,32 @@ int ScrollParser::get_total() { | |||||
| Status ScrollParser::fill_tuple(const TupleDescriptor* tuple_desc, | ||||||
| Tuple* tuple, MemPool* tuple_pool, bool* line_eof, const std::map<std::string, std::string>& docvalue_context) { | ||||||
| *line_eof = true; | ||||||
|
|
||||||
| if (_size <= 0 || _line_index >= _size) { | ||||||
| // _source is fetched from ES | ||||||
| if (!_doc_value_mode) { | ||||||
| return Status::OK(); | ||||||
| } | ||||||
|
|
||||||
| // _fields(doc_value) is fetched from ES | ||||||
| if (_total <= 0 || _line_index >= _total) { | ||||||
| return Status::OK(); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| // here is operations for `enable_doc_value_scan`. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| // This indicates that the fields does not exist(e.g. never assign values to these fields), but other fields have values. | ||||||
| // so, number of rows is >= 0, we need fill `NULL` to these fields that does not exist. | ||||||
| _line_index++; | ||||||
| tuple->init(tuple_desc->byte_size()); | ||||||
| for (int i = 0; i < tuple_desc->slots().size(); ++i) { | ||||||
| const SlotDescriptor* slot_desc = tuple_desc->slots()[i]; | ||||||
| if (slot_desc->is_materialized()) { | ||||||
| tuple->set_null(slot_desc->null_indicator_offset()); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| *line_eof = false; | ||||||
| return Status::OK(); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
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
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.