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

   ### What problem does this PR solve?
   
   File-level MIN/MAX pushdown accepts numeric casts that can turn non-null 
source values into NULL. For a BIGINT column containing `-2147483649`, `0`, and 
`2147483648`, `MIN(CAST(value AS INT))` and `MAX(CAST(value AS INT))` can both 
return NULL: the scan keeps only the original endpoints and discards the valid 
interior value.
   
   Reject file aggregate pushdown when the resolved numeric cast can introduce 
NULL, using the existing cast nullability rules independently of the source 
column's nullability. Safe widening casts continue to use pushdown. This covers 
aggregate arguments both directly and through projection aliases.
   
   ### Release note
   
   Fix incorrect MIN/MAX results over external files when a numeric cast can 
overflow or introduce NULL.
   
   ### Check List (For Author)
   
   - Test:
       - [x] Unit Test: `PhysicalStorageLayerAggregateTest` and 
`AggregateStrategiesTest` (16 passed, 3 existing skips). New unsafe-cast test 
fails before the fix and passes after it.
       - [x] FE Checkstyle.
       - Paimon end-to-end regression was not run. An unrelated existing 
`IvmNormalizeMTMVJoinTest` constructor mismatch was temporarily excluded from 
local test compilation and restored afterward.
   - Behavior changed:
       - [x] Yes. Unsafe casts evaluate file rows before aggregation; safe 
widening casts retain pushdown.
   - Does this need documentation?
       - [x] 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