You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
COALESCE expr in datafusion should perform lazy evaluation of the operands #17322
We observed that datafusion-spark's coalesce should perform lazy evaluation of the operands from left to right similar to spark . Current implementation throws an exception in case any operand throws an error which is not in alignment with spark which does lazy evaluation to return first non NULL values
changed the title [-]COALESCE expr in datafusion spark crate should perform lazy evaluation of the operands[/-][+]COALESCE expr in datafusion should perform lazy evaluation of the operands[/+]on Aug 25, 2025
Activity
coderfender commentedon Aug 25, 2025
cc : @andygrove , @kazuyukitanimura
andygrove commentedon Aug 25, 2025
For reference, this is the behavior in Postgres:
This differs from DataFusion's behavior:
andygrove commentedon Aug 25, 2025
@coderfender This issue is for DataFusion's
coalesceexpression and is not specific todatafusion-sparkas far as I know.[-]COALESCE expr in datafusion spark crate should perform lazy evaluation of the operands[/-][+]COALESCE expr in datafusion should perform lazy evaluation of the operands[/+]coderfender commentedon Aug 25, 2025
Ah that explains it (fixed the title) .
Perhaps we are adhering to postgreSQL 's coalesce implementation ?coderfender commentedon Aug 26, 2025
I can work on this once the comet's side impl is fixed .
alamb commentedon Nov 9, 2025
We merged a fix for this in the 51 release, but we have found as subtle problem so I am planning to revert it for 51 (the fix should appear in 52):
nvlandnvl2simplification #18567coderfender commentedon Feb 8, 2026
Reviving this thread to update comet side of things once we bump DF version to 52 @comphead , @andygrove
alamb commentedon Feb 9, 2026
This query works well now in datafusion 52
coderfender commentedon Mar 5, 2026
Thank you for the update @alamb . I will revert comet's fix to use DF's coalesce function then