-
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
Conversation
|
@wuyunfeng Please help to review this PR. |
|
Can you prefix [Doris On ES] on this PR title and describe the problem you resolved more meticulous and accurately |
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.
LGTM, and I left some minor comment.
@blackfox1983 Can you give some example to show How this PR works on your issue or your PR comment?
be/src/exec/es/es_scroll_parser.cpp
Outdated
| return Status::OK(); | ||
| } | ||
|
|
||
| // _fields(doc_value) is fetched from E.S. |
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.
| // _fields(doc_value) is fetched from E.S. | |
| // _fields(doc_value) is fetched from ES |
| } | ||
|
|
||
|
|
||
| // here is operations for `enable_doc_value_scan`. |
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.
| // here is operations for `enable_doc_value_scan`. | |
| // here is operations for `use_doc_value`. |
be/src/exec/es/es_scroll_parser.h
Outdated
| rapidjson::Document _document_node; | ||
| rapidjson::Value _inner_hits_node; | ||
|
|
||
| bool _use_doc_value; |
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.
maybe use doc_value_mode is more suitable?
in future, we can use different parser for _source or doc_value mode
wuyunfeng
left a comment
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.
LGTM Thanks @blackfox1983
@imay Can you spare some time to review this PR?
imay
left a comment
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.
LGTM
…ake usage of total (#3751) The other PR : #3513 (#3479) try to resolved the `inner hits node is not an array` because when a query( batch-size) run against new segment without this field, as-well the filter_path just only take `hits.hits.fields` 、`hits.hits._source` into account, this would appear an null inner hits node: ``` { "_scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAHaUWY1ExUVd0ZWlRY2", "hits": { "total": 1 } } ``` Unfortunately this PR introduce another serious inconsistent result with different batch_size because of misusing the `total`. To avoid this two problem, we just add `hits.hits._score` to filter_path when `docvalue_mode` is true, `_score` would always `null` , and populate the inner hits node: ``` { "_scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAHaUWY1ExUVd0ZWlRY2", "hits": { "total": 1, "hits": [ { "_score": null } ] } } ``` related issue: #3752
…ake usage of total (apache#3751) The other PR : apache#3513 (apache#3479) try to resolved the `inner hits node is not an array` because when a query( batch-size) run against new segment without this field, as-well the filter_path just only take `hits.hits.fields` 、`hits.hits._source` into account, this would appear an null inner hits node: ``` { "_scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAHaUWY1ExUVd0ZWlRY2", "hits": { "total": 1 } } ``` Unfortunately this PR introduce another serious inconsistent result with different batch_size because of misusing the `total`. To avoid this two problem, we just add `hits.hits._score` to filter_path when `docvalue_mode` is true, `_score` would always `null` , and populate the inner hits node: ``` { "_scroll_id": "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAHaUWY1ExUVd0ZWlRY2", "hits": { "total": 1, "hits": [ { "_score": null } ] } } ``` related issue: apache#3752
Prior to this PR, Doris On ES merged another PR #3513 which misusing the `total` node. After Doris On ES introduce `terminate_after` (#2576), the `total` documents would not be computed, rely on this `total` field would be dangerous, we just rely on the actual document count by counting the `inner hits` node which it means to be. So we just remove all total parsing and related logic from Doris On ES, this maybe improve performance slightly because of ignoring and skipping `total` json node.
…#3932) Prior to this PR, Doris On ES merged another PR apache#3513 which misusing the `total` node. After Doris On ES introduce `terminate_after` (apache#2576), the `total` documents would not be computed, rely on this `total` field would be dangerous, we just rely on the actual document count by counting the `inner hits` node which it means to be. So we just remove all total parsing and related logic from Doris On ES, this maybe improve performance slightly because of ignoring and skipping `total` json node.
#3479
Here I try to explain the cause of the problem and how to fix it.
The Cause of The problem
Take the case in issue(#3479 ) as an example:
The general results are as follows:
But in Doris on ES,Be fetched data parallelly on all shards, and use
filter_pathto reduce the network cost. The process will be as follows:Scan-Worker On BE which processed result of shard2 will failed.
The reasons are as follows:
How To Fix it
Two Method:
Pros: Fixed Code is very simple
Cons: More network cost
Pros: No loss of performance
Cons: Code is more complex
Performance first, I use Method2.
Design