Skip to content

Commit

Permalink
add some code
Browse files Browse the repository at this point in the history
  • Loading branch information
hubgeter committed Jan 15, 2025
1 parent fce72db commit 67c3141
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion be/src/vec/exec/scan/scanner_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,17 @@ void ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
eos = true;
break;
}
if (state->is_cancelled()) {
LOG(INFO) << fmt::format("[Limit Debug] QueryId = {} _scanner_scan is_cancelled",
print_id(state->query_id()));
eos = true;
}
BlockUPtr free_block = ctx->get_free_block(first_read);
if (free_block == nullptr) {
break;
}
status = scanner->get_block_after_projects(state, free_block.get(), &eos);
auto free_block_rows = free_block->rows();
first_read = false;
if (!status.ok()) {
LOG(WARNING) << "Scan thread read VScanner failed: " << status.to_string();
Expand All @@ -293,7 +299,7 @@ void ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
scan_task->cached_blocks.push_back(std::move(free_block));
}

if (limit > 0 && limit < ctx->batch_size()) {
if (limit > 0 && limit < ctx->batch_size() && free_block_rows > 0) {
break;
}
} // end for while
Expand Down
2 changes: 1 addition & 1 deletion be/src/vec/exec/scan/vscanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Status VScanner::get_block(RuntimeState* state, Block* block, bool* eof) {

LOG(INFO) << fmt::format(
"[Limit Debug] QueryId = {} Cancelled = {}, block Rows = {}, should_stop = {}",
print_id(_state->query_id()), state->is_cancelled(), block->rows(),
print_id(state->query_id()), state->is_cancelled(), block->rows(),
_should_stop);
// record rows return (after filter) for _limit check
_num_rows_return += block->rows();
Expand Down

0 comments on commit 67c3141

Please sign in to comment.