Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Sep 9, 2025

Now that Coalesce does lazy evaluation, more queries will succeed. See this PR for more details

# Datafusion - Datafusion expected results:
# Datafusion - Expected - 0
query error DataFusion error: Arrow error: Divide by zero error
query I rowsort label-3927
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given these are in files "good" I think they should be succeeding

I confirmed (for this one) that this is the answer that postgres gives

postgres=# SELECT + CAST ( - 13 AS INTEGER ) / COALESCE ( - + 14, + - NULLIF ( - COUNT ( * ), 19 * - - NULLIF ( 12, + MIN ( ALL - - ( + - 11 ) ) ) / + - 4 + - 84 + + 36 - - 57 + - + 68 * NULLIF ( + 57, + 45 ) ) * + 24 / CAST ( - 0 AS INTEGER ) / + 90, - 93 ) col0;
 col0
------
    0
(1 row)

-143550

# Datafusion - Datafusion expected results:
# Datafusion - Expected - -29
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually kind of cool -- @Omega359 's script left in the expected results, so we can see that after this change DataFusion is now actually generating the expected results

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case,

-29
-900

Copy link

@adriangb adriangb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I did not manually check every single result but I see that all of the ones I looked at now match the original expected value - amazing!

@alamb
Copy link
Contributor Author

alamb commented Sep 10, 2025

Thanks @adriangb

@alamb alamb merged commit 307079b into apache:main Sep 10, 2025
@alamb alamb deleted the alamb/update_for_coalesce branch September 10, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants