Spec: Float sort order puts `-NaN` first but says it matches Java
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
Start with the floating-point sorting rule in format/spec.md and compare it with Java's Double.compareTo behavior described in the issue. Review the discussion and proposal in issue #2891 for prior concerns. Done means the spec clearly states that all NaN representations compare equal and sort after Infinity, while stored NaN bits remain unchanged.
索引モデルが issue の本文から書いたものです。
説明
Apache Iceberg version
main (development)
Query engine
None
Please describe the bug 🐞
The sorting rule orders floats as -NaN < -Infinity < -value < -0 < 0 < value < Infinity < NaN and says this "aligns with the implementation of Java floating-point types comparisons." Java's Double.compareTo treats every NaN as equal and greater than +Infinity, so Java has no -NaN at the low end. The listed order is IEEE 754 totalOrder.
Implementations follow different halves of the sentence. Iceberg Java compares floats with Comparator.naturalOrder(), which is Double.compareTo. iceberg-rust uses total_cmp, which puts negative NaNs first and orders NaNs by payload.
Following totalOrder also makes a computed NaN's position depend on hardware. IEEE 754 doesn't specify the sign of a NaN result. For 0.0 / 0.0, x86 SSE returns 0xfff8000000000000 and AArch64 returns 0x7ff8000000000000, so the same expression sorts first on one writer and last on another. This matters most where position must be exact, such as the ordering keys in the secondary index spec (#16961), which cites this rule.
#2891 proposed removing -NaN and grouping all NaNs after Infinity. @RussellSpitzer supported it, but it was closed without a decision. The concern there was that requiring writers to canonicalize NaN is extra work and discards legitimate NaN bit patterns. #2891 also let NaN representations sort in an arbitrary order, which would leave different NaN bit patterns as distinct keys.
Could the rule say that all NaN representations compare equal and sort after Infinity? This matches Java and the sentence that already claims it does. It constrains only comparison, so stored values keep their bits and writers don't canonicalize.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- 主要言語
- Java
- スター
- 9.4k
- フォーク
- 3.7k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 169
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/iceberg のほかの issue
-
Spark: Test INSERT targets with computed IDENTIFIER expressions対応中かも @shivadarshan-devadiga が 7 日前に担当しました。 オープンimprovement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scan対応中かも @Ankitkj1999 が 9 日前に担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Flink: JdbcLockFactory concurrent lock-table creation can fail with "table already exists" and restart the job対応中かも @adiranjan25 が 16 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/iceberg#18797 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tables対応中かも @yusufyildiz34 が 29 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/iceberg#18632 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToList対応中かも @mohamed-elbrik が 34 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
speakeasy-api/speakeasy#2159 ·
メンテナーはふだん 1 日以内に返信
-
area: cli
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
vitruv-tools/NeoJoin#415 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
jenkinsci/user-guide-ai-chatbot-plugin#132 ·
メンテナーはふだん 6 日以内に返信
-
account assessment course feature lecture
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
bug db/dameng user-priority/P2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信