github-actions[bot] commented on code in PR #70846:
URL: https://github.com/apache/doris/pull/70846#discussion_r4666917554


##########
be/src/exec/common/memory.cpp:
##########
@@ -22,13 +22,16 @@
 
 namespace doris {
 
+// A full scan budget must keep INT64_MAX exact instead of converting it 
through double.
 MemShareArbitrator::MemShareArbitrator(const TUniqueId& qid, int64_t 
query_mem_limit,
                                        double max_scan_ratio)
         : query_id(qid),
           query_mem_limit(query_mem_limit),
           mem_limit(std::max<int64_t>(
-                  1, static_cast<int64_t>(static_cast<double>(query_mem_limit) 
* max_scan_ratio))) {
-}
+                  1, (max_scan_ratio == 1.0
+                              ? query_mem_limit

Review Comment:
   [P2] Bound scanner counts after preserving the full memory budget
   
   With `exec_mem_limit=9223372036854775807`, `max_scan_mem_ratio=1`, and 
`parallel_pipeline_task_num=1`, a single adaptive scan now receives the exact 
`INT64_MAX` budget. `ScannerContext::init()` passes it to `MemLimiter`, whose 
`available_scanner_count()` divides by the initial 64 MiB estimate and calls 
`cast_set<int>(137438953471)`. That throws `INTERNAL_ERROR` before 
`_available_pickup_scanner_count()` can clamp it to the real scanner 
concurrency, so even a small nonempty table scan fails without allocating a 
large buffer. Bound the count while it is still int64, before narrowing, and 
extend the endpoint test through this consumer.



##########
be/src/runtime/fragment_mgr.cpp:
##########
@@ -481,6 +482,10 @@ Status FragmentMgr::_get_or_create_query_ctx(const 
TPipelineFragmentParams& para
                                              const 
TPipelineFragmentParamsList& parent,
                                              QuerySource query_source,
                                              std::shared_ptr<QueryContext>& 
query_ctx) {
+    RETURN_IF_ERROR(validate_query_options(params.query_options));

Review Comment:
   [P1] Preserve omitted timeouts in the external-scan adapter
   
   A valid external `open_scanner` request can omit 
`TScanOpenParams.execution_timeout` because that field is optional and has no 
default. `exec_external_plan_fragment()` nevertheless copies its generated zero 
into a default-present `TQueryOptions.execution_timeout`, so this new 
validation returns `INVALID_ARGUMENT` before the scan starts. Previously zero 
disabled expiration in `QueryContext::is_timeout()`. The changed external-scan 
tests now set 60 and miss this compatibility regression. Normalize omission in 
that adapter (or preserve its supported no-timeout semantics) before applying 
the positive query-option check; retain a test that omits the field. This is 
distinct from the earlier explicit-invalid-timeout finding.



-- 
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]

Reply via email to