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

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: None
   
   Problem Summary:
   
   Casting ordinary values such as strings or variants to `AGG_STATE` can admit 
arbitrary serialized bytes as aggregate states. FE allows these conversions, 
and BE lowers the state to its serialized type before selecting the cast 
implementation, which can turn a raw string-to-state conversion into an 
identity cast. Invalid states can then produce incorrect results or fail during 
aggregation.
   
   This change rejects non-state inputs in FE cast checks and in BE before 
serialized-type lowering. It covers explicit and implicit casts and prevents 
ordinary values from being parsed into containers of aggregate states. Typed 
NULLs, matching aggregate states, and state-combinator argument coercion remain 
supported. For example, casting raw bytes to 
`agg_state<sum_map(map<string,int>)>` now fails, while `sum_map_state(map('a', 
1))` remains valid.
   
   The outfile tests now expect raw Parquet state reloads that require this 
cast to fail, and retain coverage of typed state copies where the source and 
destination schemas match. This change does not modify the serialization format 
or repair existing invalid states.
   
   ### Release note
   
   Explicit and implicit casts from ordinary values to `AGG_STATE` are 
rejected, including raw Parquet Stream Load state reloads that rely on 
`VARCHAR`-to-`AGG_STATE` conversion. Generate states with aggregate state 
combinators or copy existing states of a matching type. Typed NULLs remain 
supported.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test
   
     41 FE unit tests passed: `AggStateCastTest` (5), `CheckCastTest` (26), and 
`CombineCombinatorTest` (10). FE Checkstyle, BE header hygiene, clang-format 
16, and C++ syntax checks of both changed C++ files passed.
   
     Added three BE unit tests and regression coverage for explicit/implicit 
casts in strict and non-strict modes. The local BE unit-test build was blocked 
by the SDK dependency missing `aws/core/auth/GeneralHTTPCredentialsProvider.h`; 
BE tests and cluster regressions have not run locally. clang-tidy was attempted 
but could not complete due to toolchain resource errors and an existing NOLINT 
diagnostic.
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. Ordinary values cannot be converted into aggregate states 
through CAST, including implicit casts during loading.
   - Does this need documentation?
       - [ ] No.
       - [x] Yes. Document the restriction on raw serialized state casts and 
reloads; no documentation PR is included.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


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