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

Offen Anfängerfreundlich
#27,687 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
backend, performance

Rechercherichtung

Vier Aufrufstellen sind mit Zeilenlinks benannt: 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 und datafusion/physical-plan/src/spill/spilled_row_sizes.rs (der Fall dictionary.keys(), der möglicherweise keys.to_arc() am Kindknoten benötigt). Bestätige zuerst, dass die angepinnte arrow-Version in der workspace-Cargo.toml bereits Array::to_arc bereitstellt; falls nicht, ist das Abhängigkeits-Update eine Voraussetzung. Fertig ist, wenn jede Umgehung durch x.to_arc() ersetzt ist und cargo test für die betroffenen Crates erfolgreich läuft.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Rust
Sterne
9.6k
Forks
2.7k
Ø Merge
3 T. 17 Std.
Gemergte PRs (30 T.)
318

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/datafusion

Alle Issues in apache/datafusion

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.