BiteTheDDDDt opened a new pull request, #62355:
URL: https://github.com/apache/doris/pull/62355

   ### What problem does this PR solve?
   
   Issue Number: close #xxx
   
   Problem Summary:
   
   RuntimeFilter selectivity tracking was completely non-functional because
   `sampling_frequency` was lost during VExprContext recreation.
   
   In `RuntimeFilterConsumer::_get_push_exprs()`, `sampling_frequency=32` was 
set
   on a temporary `probe_ctx` VExprContext. However, only VRuntimeFilterWrapper
   expressions (VExpr) were returned, not the VExprContext. When
   `_append_rf_into_conjuncts()` later created a new VExprContext via
   `VExprContext::create_shared(expr)`, the new context had default
   `_sampling_frequency=-1` (DISABLE_SAMPLING).
   
   With `_sampling_frequency=-1`, the condition `(_judge_counter++) >= -1`
   evaluated to `0 >= -1 → true` on every call, causing 
`reset_judge_selectivity()`
   to fire every time. This meant selectivity counters were perpetually reset
   and never accumulated, making the runtime filter selectivity optimization
   completely ineffective.
   
   **Fix**: Store `sampling_frequency` in VRuntimeFilterWrapper (which survives
   VExprContext recreation) and propagate it to VExprContext in
   `VRuntimeFilterWrapper::open()`, which is called on both original and cloned
   contexts.
   
   ### Release note
   
   Fixed a bug where RuntimeFilter selectivity tracking was non-functional due 
to
   sampling_frequency being lost during VExprContext recreation, causing runtime
   filters that should be skipped (due to low selectivity) to never be 
identified.
   
   ### Check List (For Author)
   
   - Test: Unit Test
       - Added 2 regression tests to runtime_filter_selectivity_test.cpp
       - Added 3 new tests in vruntimefilter_wrapper_sampling_test.cpp
       - All 22 tests pass
   - Behavior changed: No (selectivity tracking was broken before, this makes 
it work as designed)
   - Does this need documentation: No


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