Use `Array::to_arc` instead of `make_array(x.to_data())` and `x.slice(0, x.len())`

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

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

まだ誰も着手していません。

評価

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

調査の方向性

呼び出し箇所は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(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

環境構築

Codespaces で開く

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

はじめの一歩

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

apache/datafusion のほかの issue

apache/datafusion の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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