github-actions[bot] commented on code in PR #61535:
URL: https://github.com/apache/doris/pull/61535#discussion_r3078796453
##########
be/src/runtime/runtime_state.h:
##########
@@ -138,7 +138,38 @@ class RuntimeState {
const DescriptorTbl& desc_tbl() const { return *_desc_tbl; }
void set_desc_tbl(const DescriptorTbl* desc_tbl) { _desc_tbl = desc_tbl; }
- MOCK_FUNCTION int batch_size() const { return _query_options.batch_size; }
+
+ // Row-count limit for output blocks (default 65535, range [1, 65535]).
+ // Consistent with SessionVariable.batchSize on FE side.
+ MOCK_FUNCTION int batch_size() const {
+ static constexpr int kDefault = 65535;
+ auto v = _query_options.batch_size;
+ return std::min(std::max(1, v), kDefault);
+ }
+
+ // Target byte budget per output block (default 8MB).
+ // FE validates the range [1MB, 512MB] in SessionVariable; BE trusts that
+ // but applies a default when the field is unset or zero.
+ MOCK_FUNCTION size_t preferred_block_size_bytes() const {
Review Comment:
This accessor is the root of the disable-path regression. It always returns
`8MB` when the session field is unset or zero, and it does not consult
`config::enable_adaptive_batch_size`. All of the newly converted callers then
keep enforcing byte budgets even when the BE config says the feature is off,
and the documented `SET preferred_block_size_bytes = 0` path can never work
here. Please return `0` for the disabled state (or gate every caller, but that
is much easier to miss).
##########
be/src/exec/operator/union_sink_operator.cpp:
##########
@@ -133,7 +133,10 @@ Status UnionSinkOperatorX::sink(RuntimeState* state,
Block* in_block, bool eos)
return Status::OK();
}
// not eos and block rows is enough to output,so push block
- if (local_state._output_block && (local_state._output_block->rows() >=
state->batch_size())) {
+ const auto block_max_bytes = state->preferred_block_size_bytes();
+ if (local_state._output_block &&
Review Comment:
This new flush condition needs the usual `block_max_bytes > 0` guard.
Otherwise, once the byte budget is correctly represented as `0` for the
disabled state, every non-empty block will satisfy `bytes() >= block_max_bytes`
and `UNION` will flush every partial block immediately instead of batching by
rows.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]