HappenLee commented on PR #66942:
URL: https://github.com/apache/doris/pull/66942#issuecomment-5392378919

   Follow-up issue: correlated scalar subqueries containing `_combine` or 
`_union` need unified empty-input handling.
   
   Both combinators produce an `AggState` and are `AlwaysNotNullable`: on empty 
input they should return a non-null serialized empty state. However, after 
decorrelation to a left outer join, an unmatched group produces SQL `NULL`. The 
current `SubqueryToApply` repair only handles `NotNullableAggregateFunction` 
through `resultForEmptyInput()`, while `_combine`/`_union` have no typed 
empty-AggState expression that can be used as the fallback value. Simply making 
the combinators nullable would only hide the semantic mismatch.
   
   A complete fix should introduce a shared empty-input-result contract and a 
typed empty `AggState` expression generated by BE, then rewrite the output as 
`ifnull(state_slot, empty_agg_state)`, consistently for both `_combine` and 
`_union`. Since this requires broader FE/BE support, we will handle it 
uniformly in a follow-up PR instead of special-casing it in this PR.


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