Use `Array::to_arc` instead of `make_array(x.to_data())` and `x.slice(0, x.len())`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust
- 領域
- backend, performance
調査の方向性
呼び出し箇所は4つあり、行へのリンク付きで示されています: datafusion/physical-expr-common/src/datum.rs、datafusion/physical-expr/src/expressions/in_list/array_static_filter.rs、datafusion/physical-expr-common/src/utils.rs、datafusion/physical-plan/src/spill/spilled_row_sizes.rs(dictionary.keys() のケースでは、子ノードに keys.to_arc() が必要になる可能性があります)。まず、ワークスペースの Cargo.toml で固定されている arrow のバージョンが既に Array::to_arc を公開しているかを確認してください。公開していない場合は、依存関係の更新が前提作業になります。各回避策を x.to_arc() に置き換え、影響を受けるクレートで cargo test が通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem or challenge?
arrow-rs adds Array::to_arc in apache/arrow-rs#12420, and it is expected to ship in arrow 60.3.0 or 61.0.0. It returns an ArrayRef that shares the buffers of a &dyn Array. When the &dyn Array is an &ArrayRef, it returns a new reference to the same allocation.
DataFusion has four places outside tests that turn a &dyn Array into an ArrayRef with a workaround:
make_array(array.to_data())innormalize_nested_float_zero: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr-common/src/datum.rs#L128-L131make_array(v.to_data())inArrayStaticFilter::contains: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr/src/expressions/in_list/array_static_filter.rs#L132truthy.slice(0, truthy.len())in the all-true fast path ofscatter: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr-common/src/utils.rs#L80-L82make_array(dictionary.keys().to_data())inColumnSize::new: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-plan/src/spill/spilled_row_sizes.rs#L158
make_array(x.to_data()) builds an ArrayData and then rebuilds a typed array from it, and nested types repeat that for every child. slice(0, len) recounts the null buffer's nulls and re-slices the children of nested types. to_arc clones an arrow-rs array into a new Arc, and for an ArrayRef it only increments the reference count.
Describe the solution you'd like
After DataFusion upgrades to an arrow release that includes Array::to_arc, replace each workaround above with x.to_arc().
Describe alternatives you've considered
We could keep the workarounds. They return equal arrays but do more work per call.
Additional context
The same arrow-rs PR switches arrow's own cast, concat, nullif, and shift from these workarounds to to_arc.
- 主要言語
- Rust
- スター
- 9.6k
- フォーク
- 2.7k
- 平均マージ
- 3日 17時間
- マージ済み PR(30日)
- 318
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
apache/datafusion#27688 ·
メンテナーはふだん 1 日以内に返信
-
`verify-release-candidate.sh` version check doesn't catch `-dev` versions and is skipped on macOS対応中かも @vinycalves が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion#27563 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
`MoveTowardsLeafNodes` placement implies speculative evaluation, but the docs don't say so対応中かも @Inf1mum が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/datafusion#27487 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
`lpad` and `rpad` with a literal length above `i32::MAX` error on a NULL string or fill対応中かも @TechWizard9999 が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
apache/datafusion#27482 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Window constructors panic when the expression list is empty対応中かも @abp002 が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/datafusion#27315 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
apache/datafusion の issue をすべて見る
似ている issue
-
ai_p1 comp-sql-syntax
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
ClickHouse/ClickHouse#133888 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
horizon-rust/horizon#20542 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
LadybirdBrowser/ladybird#15521 ·
メンテナーはふだん 1 日以内に返信
-
macOS: the Save Diagnostics panel goes behind the editor after an app switch and can't be reachedオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getopenscreen/openscreen#1667 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
erkamyaman/rust-anything#371 ·
メンテナーはふだん 1 日以内に返信