Skip to content

Avoid treating incomparable scalars as equal - #16624

Merged
findepi merged 4 commits into
apache:mainfrom
findepi:findepi/avoid-treating-incomparable-scalars-as-equal-bed985
Jul 1, 2025
Merged

Avoid treating incomparable scalars as equal#16624
findepi merged 4 commits into
apache:mainfrom
findepi:findepi/avoid-treating-incomparable-scalars-as-equal-bed985

Conversation

@findepi

Copy link
Copy Markdown
Member

Fix calls to ScalarValue::partial_cmp that treat None return value as equivalent to equality. The partial_cmp returns None when values cannot be compared, for example they have incompatible types. Apparently, in all these places it is an error condition when values cannot be compared.

@github-actionsgithub-actionsBot added optimizer Optimizer rules core Core DataFusion crate common Related to common crate functions Changes to functions implementation labels Jun 30, 2025
Fix calls to `ScalarValue::partial_cmp` that treat `None` return value
as equivalent to equality. The `partial_cmp` returns `None` when values
cannot be compared, for example they have incompatible types.
Apparently, in all these places it is an error condition when values
cannot be compared.
@findepi
findepiforce-pushed the findepi/avoid-treating-incomparable-scalars-as-equal-bed985 branch from 6843dbb to 6d1654fCompareJune 30, 2025 12:51

@alambalamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @findepi -- I think this will improve our ability to find and fix bugs 👍

Comment threaddatafusion/common/src/scalar/mod.rs Outdated
Comment threaddatafusion/common/src/scalar/mod.rs
findepiand others added 2 commits July 1, 2025 00:41
Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
@findepi
findepi merged commit 47f75ef into apache:mainJul 1, 2025
27 checks passed
@findepi
findepi deleted the findepi/avoid-treating-incomparable-scalars-as-equal-bed985 branch July 1, 2025 09:42
jcsherin added a commit to jcsherin/datafusion that referenced this pull request Nov 23, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commonRelated to common cratecoreCore DataFusion cratefunctionsChanges to functions implementationoptimizerOptimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@findepi@alamb