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

   [fix](fe) Preserve false aggregate arguments in not-null inference
   
   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: None
   
   Problem Summary: A global aggregate over a left outer join returned an 
incorrect result for expressions such as `COUNT(r.v IS NOT NULL)`. 
`InferAggNotNull` reused predicate-style not-null inference, where replacing 
`r.v` with NULL and folding the expression to FALSE is considered 
null-rejecting. FALSE rejects a filter predicate, but it is a valid non-NULL 
aggregate argument that COUNT must count. The generated `r.v IS NOT NULL` 
filter therefore enabled outer join elimination and discarded null-extended 
rows. Add aggregate-specific inference that only treats a folded SQL NULL 
result as discardable, while preserving the existing FALSE-or-NULL behavior for 
predicate inference. After the fix, the boolean COUNT keeps the left outer join 
and returns all three rows, while `COUNT(r.v)` still infers not-null, uses an 
inner join, and returns one row.
   
   ### Release note
   
   Fix incorrect aggregate results when an argument evaluates to FALSE for a 
NULL input from an outer join.
   
   ### Check List (For Author)
   
   - Test:
       - Regression test
       - Unit Test
   - Behavior changed: Yes. Preserve FALSE aggregate arguments and prevent 
invalid outer join elimination.
   - Does this need documentation: 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