Uh oh!
There was an error while loading. Please reload this page.
[fix](result-sink)Fix the correctness of the results when multiple be and dry_run_query=true. - #53653
Conversation
… and dry_run_query=true.
hello-stephen
commented
Jul 21, 2025
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
hubgeter
commented
Jul 21, 2025
run buildall |
doris-robot
commented
Jul 21, 2025
TPC-H: Total hot run time: 34231 ms |
doris-robot
commented
Jul 21, 2025
TPC-DS: Total hot run time: 190819 ms |
doris-robot
commented
Jul 21, 2025
ClickBench: Total hot run time: 32.62 s |
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
BiteTheDDDDt
commented
Jul 22, 2025
Can you add some test case for this problem? |
There is already p2 case. |
| // statistics->set_returned_rows(returned_rows); | ||
| // In a multi-mysql_result_writer scenario, since each mysql_result_writer will set this rows, in order | ||
| // to avoid missing rows when dry_run_query = true, they should all be added up. | ||
| numReceivedRows += resultBatch.getQueryStatistics().getReturnedRows(); |
There was a problem hiding this comment.
If one backend returns multiple batches, does it will the repeated calculation lead to result row number more than real?
There was a problem hiding this comment.
I don't think it will happen. returned_rows set by BE will only be increased during the close phase of ResultBlockBuffer. Reference:src/runtime/result_block_buffer.cpp:ResultBlockBuffer<ResultCtxType>::close(....)
… and dry_run_query=true. (apache#53653) Related PR: apache#36053 && apache#53209 Problem Summary: Fixed the issue that the result of `dry_run_query=true` is wrong in multi-be scenarios (the number of rows is less) I think this may be related to the multi result sink introduced in pr apache#36053 && apache#53209. Reason: ```cpp vmysql_result_writer.cpp GetResultBatchCtx::on_close() { ... statistics->set_returned_rows(returned_rows); // Set only once per result_writer. ... } ``` ``` java if (connectContext != null && connectContext.getSessionVariable().dryRunQuery) { if (resultBatch.isEos()) { // This will only be counted once. numReceivedRows += resultBatch.getQueryStatistics().getReturnedRows(); } } else if (resultBatch.getBatch() != null) { numReceivedRows += resultBatch.getBatch().getRowsSize(); } ``` If there are multiple be, there will be multiple result sinks, and each result sink will update its own row count at the end. Since `resultBatch.isEos()` is only triggered once, the row count information is less.
What problem does this PR solve?
Related PR: #36053 && #53209
Problem Summary:
Fixed the issue that the result of
dry_run_query=trueis wrong in multi-be scenarios (the number of rows is less)I think this may be related to the multi result sink introduced in pr #36053 && #53209.
Reason:
If there are multiple be, there will be multiple result sinks, and each result sink will update its own row count at the end. Since
resultBatch.isEos()is only triggered once, the row count information is less.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)