Skip to content

Fix PartialOrd for Window - #17393

Merged
findepi merged 1 commit into
apache:mainfrom
findepi:findepi/fix-partialord-for-window-12e6f3
Sep 4, 2025
Merged

Fix PartialOrd for Window#17393
findepi merged 1 commit into
apache:mainfrom
findepi:findepi/fix-partialord-for-window-12e6f3

Conversation

@findepi

Copy link
Copy Markdown
Member

Before the changes, PartialOrd could return Some(Equal) for two Window nodes 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-actionsgithub-actionsBot added the logical-expr Logical plan and expressions label Sep 3, 2025

@xudong963xudong963 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we have a test for this?

Before the changes, `PartialOrd` could return `Some(Equal)` for two
`Window` nodes 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
findepiforce-pushed the findepi/fix-partialord-for-window-12e6f3 branch from 94ba958 to df03566CompareSeptember 4, 2025 10:28
@findepi

Copy link
Copy Markdown
MemberAuthor

added a test

@findepi
findepi merged commit e8d56e1 into apache:mainSep 4, 2025
28 checks passed
@findepi
findepi deleted the findepi/fix-partialord-for-window-12e6f3 branch September 4, 2025 17:07
destrex271 pushed a commit to destrex271/datafusion that referenced this pull request Sep 5, 2025
Before the changes, `PartialOrd` could return `Some(Equal)` for two
`Window` nodes 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.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-exprLogical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@findepi@timsaucer@xudong963