Compiler plugin: refine `reorderColumnsBy` / `reorderColumnsByName` with `inFrameColumns`

Offen
#2,139 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
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
kotlin
Bereich
compilers, data

Rechercherichtung

Start with the ReorderColumnsByName interpreter in the Kotlin repository and the reorderColumnsByName / reorderColumnsBy overloads that take inFrameColumns. Step 1 depends on the dataframe-dev bump that includes #2130, so the change cannot be made until that lands. Done means the new interpreter declares inFrameColumns, the overload carries @Refine and @Interpretable, and the compile-time schema matches the runtime column order for nested frame columns.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Compiler plugin

reorderColumnsByName(atAnyDepth, desc, inFrameColumns) and reorderColumnsBy(atAnyDepth, desc, inFrameColumns) { }
were added in #2130 without @Refine. With the compiler plugin, the result of such a call keeps the receiver's
compile-time schema, so its column order is not updated.

They are not refined because the ReorderColumnsByName interpreter in the Kotlin repository declares only
receiver, atAnyDepth and desc. An argument the interpreter does not declare makes interpret() return
null, and the plugin then materializes an empty schema, so accessors on the result stop compiling. An
interpreter name the plugin does not know has the same effect.

Steps:

  1. After dataframe-dev in the Kotlin repository includes #2130, add inFrameColumns support to the
    interpreter (a new interpreter, or val Arguments.inFrameColumns: Boolean by arg(defaultValue = Present(false))).
  2. Add @Refine / @Interpretable to the new reorderColumnsByName overload. Do this only once the minimal
    Kotlin version supported with the compiler plugin contains step 1; with an older plugin the call gets an
    empty schema.
  3. Optionally, refine reorderColumnsBy too. Like by / byDesc, its expression is arbitrary code.

Until the dataframe-dev bump, reorderColumnsByName() is interpreted with the old :core, which still
reorders the columns inside frame columns, so the compile-time schema of nested frame columns can differ
from the runtime one. Columns are accessed by name, so code keeps working.

Vorherrschende Sprache
Kotlin
Sterne
1.1k
Forks
87
Ø Merge
2 T. 21 Std.
Gemergte PRs (30 T.)
40

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 Kotlin/dataframe

Alle Issues in Kotlin/dataframe

Ähnliche Issues

Weitere Issues zu Kotlin

Neue Issues direkt in Ihr Postfach

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