Skip to content

[codegen] Fix wrong sort order for float and double columns with nan - #8295

Merged
JingsongLi merged 1 commit into
apache:masterfrom
ArnavBalyan:arnavb/fix-float-double-compare
Jun 20, 2026
Merged

JingsongLi merged 1 commit into
apache:masterfrom
ArnavBalyan:arnavb/fix-float-double-compare

Conversation

@ArnavBalyan

Copy link
Copy Markdown
Member

Purpose

  • Float and double comparators reused the integer ternary, which is not correct since nan compares equal to everything and signed zero is treated as equal.
  • This silently misorders any sort or clustering on a float or double column containing nan, and can cause buggy java sort.
  • Switch the float and double cases to the jdk total order comparison.

Tests

  • UT

@ArnavBalyan

Copy link
Copy Markdown
Member Author

cc @leaves12138 @JingsongLi thanks! :)

@JingsongLi JingsongLi 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.

+1

@JingsongLi
JingsongLi merged commit 34e9b9f into apache:master Jun 20, 2026
12 checks passed
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