Skip to content

Conversation

findepi
Copy link
Member

@findepi findepi commented Sep 5, 2025

Before the changes, PartialOrd could return Some(Equal) for two values that are not equal in PartialEq sense. This is violation of PartialOrd contract.

The fix is to consult eq inside ord implementation. If ord thinks two instances are equal, but they are not equal in Eq sense, they are considered incomparable.

Before the changes, `PartialOrd` could return `Some(Equal)` for two
values that are not equal in `PartialEq` sense. This is violation of
`PartialOrd` contract.

The fix is to consult eq inside ord implementation. If ord thinks two
instances are equal, but they are not equal in Eq sense, they are
considered incomparable.
@github-actions github-actions bot added the logical-expr Logical plan and expressions label Sep 5, 2025
Before the changes, `PartialOrd` could return `Some(Equal)` for two
values that are not equal in `PartialEq` sense. This is violation of
`PartialOrd` contract.

The fix is to consult eq inside ord implementation. If ord thinks two
instances are equal, but they are not equal in Eq sense, they are
considered incomparable.
@findepi findepi changed the title Fix PartialOrd for DDL & DML Fix PartialOrd for logical plan nodes and expressions Sep 5, 2025
@github-actions github-actions bot added optimizer Optimizer rules substrait Changes to the substrait crate labels Sep 5, 2025
@findepi findepi requested review from alamb and timsaucer September 5, 2025 12:27
Copy link
Contributor

@alamb alamb left a comment

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 we can make this faster

@findepi findepi merged commit 0c7d830 into apache:main Sep 9, 2025
28 checks passed
@findepi findepi deleted the findepi/fix-partialord-for-ddl-dml-38b9ac branch September 9, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions optimizer Optimizer rules substrait Changes to the substrait crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect implementation of PartialOrd for ScalarUDF, WindowUDF and AggregateUDF
2 participants