[Bug] format_string with %#e puts the decimal point after the exponent

オープン 初心者向け
#423 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@vaidik787 がすでに取り組んでいます。

2026年11月27日 から。

  • #427 @vaidik787 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend

調査の方向性

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/datafusion-spark のほかの issue

apache/datafusion-spark の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。