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

   ### What problem does this PR solve?
   
   Problem Summary:
   
   This pull request refactors and enhances the handling of aggregate state 
types (`AggStateType`) in the codebase, improving how nullability is tracked 
and simplifying related logic. The most important changes include adding 
explicit support for the return nullability of aggregate functions, refactoring 
the construction and conversion of `AggStateType`, and extracting utility logic 
for mocked expressions.
   
   Enhancements to `AggStateType` and nullability tracking:
   
   * Added a `returnNullable` field to `AggStateType`, ensuring that the 
nullability of aggregate function results is explicitly tracked and propagated 
throughout the codebase. All constructors and usages of `AggStateType` have 
been updated to include this field. 
[[1]](diffhunk://#diff-bf1978d57acdd865d169ed2b9c0b67c932698cf9313e5947078f11fb8d151335R62-R85)
 
[[2]](diffhunk://#diff-8ef1d9bfc0b70b41ae4beb552ff49886a734d9f76a8fdd917e2659e9f5bbf4e9L5091-R5092)
 
[[3]](diffhunk://#diff-3689e25f9f4e37beae29567d8ec2d8c220f3fd725076a992f29f515bd9fa4604L69-R74)
 
[[4]](diffhunk://#diff-3689e25f9f4e37beae29567d8ec2d8c220f3fd725076a992f29f515bd9fa4604L86-R92)
 
[[5]](diffhunk://#diff-89f6ec1889e94e1bb1e8a50f5a5cb5b019564172e75e9e67979b2b3355062f2fL446-R447)
   * Updated conversion and catalog methods in `AggStateType` to use the new 
`returnNullable` field, ensuring correct type conversion and catalog 
representation.
   
   Refactoring and code simplification:
   
   * Extracted the logic for generating mocked expressions from `AggStateType` 
into a new utility class, `DataTypeUtils`, making the code more modular and 
reusable. All relevant usages have been updated to use this new utility. 
[[1]](diffhunk://#diff-2cd3e85294abe0336744f457d090888bcc3e0a864e484c9c9b59ae729e16be67L78-R79)
 
[[2]](diffhunk://#diff-2cd3e85294abe0336744f457d090888bcc3e0a864e484c9c9b59ae729e16be67L124-R125)
 
[[3]](diffhunk://#diff-6cd78459d3dd1bf19727fe12f4a5b14d5319991a7fe1bf45d5dbb9e4a3e16e80R1-R39)
   * Updated test cases to use the new `AggStateType` constructor with the 
`returnNullable` parameter, ensuring tests reflect the new nullability 
tracking. 
[[1]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L99-R99)
 
[[2]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L137-R137)
 
[[3]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L183-R183)
 
[[4]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L229-R229)
 
[[5]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L275-R275)
 
[[6]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L321-R321)
 
[[7]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L367-R367)
 
[[8]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e4c46bd49359c1b237a7e77410a2L416-R416)
 [[9]](diffhunk://#diff-4126c768e4468f1da30a7300e2749a23f8f1e
 4c46bd49359c1b237a7e77410a2L465-R465)
   
   Dependency and import updates:
   
   * Added necessary imports for new utility classes and traits to maintain 
consistency and support the refactored logic. 
[[1]](diffhunk://#diff-2cd3e85294abe0336744f457d090888bcc3e0a864e484c9c9b59ae729e16be67R31)
 
[[2]](diffhunk://#diff-3689e25f9f4e37beae29567d8ec2d8c220f3fd725076a992f29f515bd9fa4604R20)
 
[[3]](diffhunk://#diff-3689e25f9f4e37beae29567d8ec2d8c220f3fd725076a992f29f515bd9fa4604R32)
   
   These changes collectively improve the robustness and clarity of aggregate 
state type handling, particularly around nullability, and make the codebase 
easier to maintain and extend.
   
   ### 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?
       - [ ] 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