Baymine opened a new issue, #65917:
URL: https://github.com/apache/doris/issues/65917

   ### Description
   
   The nereids `date_format` scalar function declares its nullability via 
`PropagateNullable`, so FE infers the result as **non-nullable** whenever both 
inputs are non-nullable. However, the BE implementation can return NULL for 
non-null input (e.g. when the format string is invalid or an edge-case value 
cannot be formatted), so FE's inferred nullability is wrong and mismatches BE.
   
   This causes incorrect nullability metadata to be propagated through the 
query plan, which can lead to wrong results or crashes when BE actually 
produces NULLs for a column FE believes is non-nullable.
   
   ### How to reproduce
   
   ```sql
   -- FE infers the result as non-nullable (both args non-null), but BE may
   -- return NULL for problematic inputs.
   SELECT date_format(dt, '%Y-%m-%d') FROM t;
   ```
   
   When `dt` is non-nullable but a row's value/format triggers a NULL result in 
BE, the mismatch between FE's non-nullable metadata and BE's actual NULL output 
can cause incorrect behavior.
   
   ### Expected behavior
   
   `date_format` should always be treated as nullable by FE, matching BE — the 
same treatment already given to the sibling `str_to_date` function (which uses 
`AlwaysNullable`), and as documented in the `AlwaysNullable` interface javadoc 
which lists `date_format` as an example.
   


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