Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1190,9 +1190,11 @@ public RowBatch getNext() throws Exception {
}

if (ConnectContext.get() != null && ConnectContext.get().getSessionVariable().dryRunQuery) {
if (resultBatch.isEos()) {
numReceivedRows += resultBatch.getQueryStatistics().getReturnedRows();
}
// In BE: vmysql_result_writer.cpp:GetResultBatchCtx::on_close()
// 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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If one backend returns multiple batches, does it will the repeated calculation lead to result row number more than real?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(....)

} else if (resultBatch.getBatch() != null) {
numReceivedRows += resultBatch.getBatch().getRowsSize();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ public RowBatch getNext() throws UserException, InterruptedException, TException

ConnectContext connectContext = coordinatorContext.connectContext;
if (connectContext != null && connectContext.getSessionVariable().dryRunQuery) {
if (resultBatch.isEos()) {
numReceivedRows += resultBatch.getQueryStatistics().getReturnedRows();
}
// In BE: vmysql_result_writer.cpp:GetResultBatchCtx::on_close()
// 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();
} else if (resultBatch.getBatch() != null) {
numReceivedRows += resultBatch.getBatch().getRowsSize();
}
Expand Down
Loading