[Bug] format_string with %#e puts the decimal point after the exponent
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
crates/spark/src/function/string/format_string.rs の1796行目付近にある alt_form 分岐から始めてください。issueには、小数点が指数部の後に追加されると記載されています。format_string の %e フォーマット経路と関連するテストを確認してください。%#.0e が小数点を指数部の前に置き、Sparkの例 5.e+00 と 0.e+00 に一致すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
format_string with the # flag on %e puts the decimal point after the exponent. format_string('%#.0e', 5.0) returns 5e+00., where Spark returns 5.e+00.
The alt_form branch appends . to the whole formatted number when it has no decimal point (format_string.rs#L1796). For %e the number already ends in the exponent at that point, so the . lands after it. It should go after the mantissa.
To Reproduce
SELECT format_string('%#.0e', CAST(5.0 AS DOUBLE));
datafusion-spark returns 5e+00..
Expected behavior
As in Spark (Java String.format):
5.e+00
%#.0e of 0.0 gives 0.e+00 in Spark. %#e with the default precision already has a decimal point, so it is not affected.
Spark versions
Checked on PySpark 4.2.0 and 3.5.9, which give the same result.
datafusion-spark version
main at ab9d308
Additional context
Found while reviewing #416, which fixes zero for %e and %g. This bug is separate from that one.
- 主要言語
- Rust
- スター
- 13
- フォーク
- 31
- 平均マージ
- 2日 2時間
- マージ済み PR(30日)
- 96
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion-spark のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
apache/datafusion-spark#440 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
apache/datafusion-spark#439 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
apache/datafusion-spark#431 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] width_bucket returns NULL for an infinite value対応中かも @vaidik787 が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-spark#424 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] parse_url ignores the key for a part other than QUERY, Spark returns NULL対応中かも @Aryan2210 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
apache/datafusion-spark#409 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
apache/datafusion-spark の issue をすべて見る
似ている issue
-
autofix:working
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
libracoder/kiri#1138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
roc-lang/basic-webserver#277 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
samkerrcode/opengent#113 ·
メンテナーはふだん 1 日以内に返信
-
app bug session
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信