date_format FE/BE nullability mismatch: FE marks result non-nullable but BE can return NULL
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start by locating the nereids date_format scalar function and its PropagateNullable declaration, then compare it with str_to_date and the AlwaysNullable interface javadoc mentioned in the issue. Done means FE treats date_format as nullable, matching the BE behavior and the documented AlwaysNullable treatment.
Written by the indexing model from the issue text.
Description
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
-- 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.
- Dominant language
- Java
- Stars
- 16k
- Forks
- 4k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 569
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/doris
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100