Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Deduplicate bucket computation in width_bucket_interval_mdn_exact

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

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

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

2026年10月14日 から。

評価

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

調査の方向性

spark/src/function/math/width_bucket.rs の width_bucket_interval_mdn_exact から始めてください。"only month" と "months equals" の分岐では、範囲外チェック、幅のガード、バケットのクランプが繰り返されています。2つの分岐を比べて、どの部分が異なるかを確認してください。主な違いは、x、l、h が f64 にどのように変換されているかです。変換済みの値を受け取り Option<i64> を返す共通ヘルパーを抽出し、両方の分岐からそれを呼び出すようにしてください。両方の分岐がヘルパーを使用し、既存の width_bucket テストが変更なしで通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement good first issue help wanted spark tech debt
Is your feature request related to a problem or challenge?

width_bucket_interval_mdn_exact (spark/src/function/math/width_bucket.rs#L300-L431) contains two near-identical blocks, "only month" (about L330-L366) and "months equals" (about L368-L424). Each repeats:

  • the ascending/descending out-of-range checks (bucket 0 or num_buckets + 1),
  • the bucket-width computation with its zero / non-finite null guard,
  • the floor-plus-one bucket clamp.

They differ only in how x, l and h are projected to f64 (months vs. day/nanosecond offset relative to l). Duplicated numeric edge-case handling like this is where a boundary fix ends up in only one copy.

Describe the solution you'd like

Extract fn bucket_from_f64(x: f64, l: f64, h: f64, num_buckets: i64, ascending: bool) -> Option<i64> (returning None for null). Each branch then only computes its projected (x, l, h) and calls it. Optionally move the per-row body into a helper returning Option<i64> so the continue chains disappear. The existing width_bucket tests cover the behaviour.

Describe alternatives you've considered

None.

Additional context

This is small and self-contained, a good first issue. Line references are pinned to commit 0d79252f61bd.

主要言語
Rust
スター
9.4k
フォーク
2.5k
平均マージ
4日 13時間
マージ済み PR(30日)
353

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

apache/datafusion のほかの issue

apache/datafusion の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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