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

   ### What problem does this PR solve?
   
   Problem Summary:
   
   This pull request refactors how grouping and virtual slot logic is handled 
in the Nereids query planner, removing the use of `VirtualSlotReference` and 
related logic in favor of more explicit handling of grouping functions and 
grouping IDs. This simplifies the codebase and makes grouping set handling more 
robust and maintainable.
   
   **Refactoring grouping and virtual slot logic:**
   
   * Removed all references and special handling for `VirtualSlotReference` 
across the codebase, including imports, type checks, and related logic in 
`ExpressionTranslator`, `PhysicalPlanTranslator`, `PlanTranslatorContext`, and 
analysis rules. 
[[1]](diffhunk://#diff-2c4fc9eb93bc201b1fc73fd5bbfeb60f3138e5063707b661a51f617418a2db5cL83)
 
[[2]](diffhunk://#diff-f363369b49ec5af5a087420f31ec3d9a8c5147eacabdf051792017cfab289dacL107-R110)
 
[[3]](diffhunk://#diff-73d395bdaf1754e51e7f2c9dabaa8e27a78fabb244995d6ed0f98d0b07293d13L27)
 
[[4]](diffhunk://#diff-e5076e5f12e7289f6f98f8e532fb50bdd01a55f6e9ff6dafebc763828b453f7aL32)
 
[[5]](diffhunk://#diff-c89012884aea51ce8f9b302110cd2e05ea5767905b417d21d3620150b6a5650bL31)
   * Updated the logic in `PhysicalPlanTranslator` to use grouping functions 
directly (via `GroupingScalarFunction`) and to explicitly include the grouping 
ID slot in output slot construction for repeat nodes, improving correctness and 
clarity. 
[[1]](diffhunk://#diff-f363369b49ec5af5a087420f31ec3d9a8c5147eacabdf051792017cfab289dacL2463-R2469)
 
[[2]](diffhunk://#diff-f363369b49ec5af5a087420f31ec3d9a8c5147eacabdf051792017cfab289dacL2481-R2482)
 
[[3]](diffhunk://#diff-f363369b49ec5af5a087420f31ec3d9a8c5147eacabdf051792017cfab289dacL2503-R2502)
   * Simplified slot descriptor creation in `PlanTranslatorContext` by removing 
special handling for virtual slots and always using `SlotRef`, streamlining 
slot management. 
[[1]](diffhunk://#diff-73d395bdaf1754e51e7f2c9dabaa8e27a78fabb244995d6ed0f98d0b07293d13R310-L320)
 
[[2]](diffhunk://#diff-73d395bdaf1754e51e7f2c9dabaa8e27a78fabb244995d6ed0f98d0b07293d13L329)
   
   **Analysis and rule improvements:**
   
   * Enhanced analysis rules to correctly allow grouping scalar functions only 
in repeat plans, and to properly ignore the grouping ID slot when checking slot 
references from children, making validation stricter and more accurate. 
[[1]](diffhunk://#diff-e5076e5f12e7289f6f98f8e532fb50bdd01a55f6e9ff6dafebc763828b453f7aR76)
 
[[2]](diffhunk://#diff-e5076e5f12e7289f6f98f8e532fb50bdd01a55f6e9ff6dafebc763828b453f7aL88-R88)
 
[[3]](diffhunk://#diff-e5076e5f12e7289f6f98f8e532fb50bdd01a55f6e9ff6dafebc763828b453f7aL113-R126)
 
[[4]](diffhunk://#diff-e5076e5f12e7289f6f98f8e532fb50bdd01a55f6e9ff6dafebc763828b453f7aL145-L157)
   * Updated the normalization rule for repeat plans to bind grouping IDs 
explicitly and to use `BigIntType` for grouping IDs, removing dependency on 
virtual slot binding. 
[[1]](diffhunk://#diff-c89012884aea51ce8f9b302110cd2e05ea5767905b417d21d3620150b6a5650bR40)
 
[[2]](diffhunk://#diff-c89012884aea51ce8f9b302110cd2e05ea5767905b417d21d3620150b6a5650bL89-R89)
   
   ### Release note
   
   None
   
   ### 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)
       - [x] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [x] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [x] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [x] 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