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

   ### What problem does this PR solve?
   This pull request refactors and simplifies the handling of late-arriving 
runtime filters and conjunct context cloning in the scan pipeline. The main 
changes include streamlining the interfaces for applying runtime filters, 
improving thread safety with new locking mechanisms, and removing redundant or 
duplicated code. The changes also clarify ownership and lifecycle of conjunct 
expressions to prevent concurrent access issues.
   
   **Runtime filter and conjunct management improvements:**
   
   * Refactored `try_append_late_arrival_runtime_filter` in 
`RuntimeFilterConsumerHelper` to use references instead of pointers for 
`arrived_rf_num` and conjuncts, and updated all call sites accordingly for 
clearer and safer usage. 
[[1]](diffhunk://#diff-ed4cbc22dcb1b5d27652827cea0f12373591a9b06e3c857f0dd0e32f58422026L99-R110)
 
[[2]](diffhunk://#diff-61d96ad649abf519ee21143b6a4d9ed0c1b820ba273281ca8650a1e047d10f15L47-R50)
 
[[3]](diffhunk://#diff-04a5f666c19cc90dfb8f222f1fadc43f08fa2d59f5ae61e2889e615e3cffc35dL101-R101)
 
[[4]](diffhunk://#diff-2c575051a29b06200611882d17cb4c0fea6df46659e8ea953c705aaca2c2b5a4L232-R245)
   * Removed the redundant `clone_conjunct_ctxs` method from 
`RuntimeFilterConsumerHelper` and moved conjunct cloning logic into 
`ScanLocalStateBase`, introducing new methods 
`update_late_arrival_runtime_filter` and `clone_conjunct_ctxs` for better 
encapsulation. 
[[1]](diffhunk://#diff-ac38473f151ccd99db4ed80dfbfa176f4f957ae2f5335ce8fbb4f5dbb0e932e9R76-R91)
 
[[2]](diffhunk://#diff-f5a0db9faf0b649227b0126cca493d8dce22c9d497116fd480d7d018ce1696d2R91-R94)
 
[[3]](diffhunk://#diff-ed4cbc22dcb1b5d27652827cea0f12373591a9b06e3c857f0dd0e32f58422026L123-R128)
 
[[4]](diffhunk://#diff-61d96ad649abf519ee21143b6a4d9ed0c1b820ba273281ca8650a1e047d10f15L47-R50)
 
[[5]](diffhunk://#diff-2c575051a29b06200611882d17cb4c0fea6df46659e8ea953c705aaca2c2b5a4L232-R245)
   
   **Thread safety enhancements:**
   
   * Added a `std::mutex _conjuncts_lock` to `ScanLocalStateBase` and used it 
to guard access to `_conjuncts` for thread-safe updates and cloning. 
[[1]](diffhunk://#diff-f5a0db9faf0b649227b0126cca493d8dce22c9d497116fd480d7d018ce1696d2R21)
 
[[2]](diffhunk://#diff-f5a0db9faf0b649227b0126cca493d8dce22c9d497116fd480d7d018ce1696d2R128)
 
[[3]](diffhunk://#diff-ac38473f151ccd99db4ed80dfbfa176f4f957ae2f5335ce8fbb4f5dbb0e932e9R76-R91)
 
[[4]](diffhunk://#diff-f5a0db9faf0b649227b0126cca493d8dce22c9d497116fd480d7d018ce1696d2R91-R94)
   
   **Scanner and file scanner lifecycle fixes:**
   
   * Changed handling of conjuncts in `FileScanner` and `Scanner` to avoid 
destroying conjuncts that may still be in use, by explicitly moving them to a 
`_stale_expr_ctxs` vector before clearing. Removed the `_discard_conjuncts` 
method and replaced it with direct management. 
[[1]](diffhunk://#diff-6afbc092caa913a8775be9772777060161de5608b9aae939202e963e8aaf4e8bL360-L366)
 
[[2]](diffhunk://#diff-2c575051a29b06200611882d17cb4c0fea6df46659e8ea953c705aaca2c2b5a4L232-R245)
 
[[3]](diffhunk://#diff-17432beb88ab0d918d9bbe41b3ba500e3f5102645896e89587a4dc43bcab2125L192-L198)
   
   **Minor interface improvements:**
   
   * Made `Scanner::is_open()` a `const` method for correctness.
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


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