Kotlin / Kotlin/dataframe

Replace forced column resolution with column origin tracking

Open
#457 0 comments 0 reactions 0 assignees View on GitHub
bug enhancement
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Columns created with [`columnOf()`](https://github.com/Kotlin/dataframe/blob/80e346f2797cd6a27afe249cc9315dbaa9a9aaa6/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt#L180)/[`column(Iterable)`](https://github.com/Kotlin/dataframe/blob/80e346f2797cd6a27afe249cc9315dbaa9a9aaa6/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt#L200)/[`Iterable.toColumn()`](https://github.com/Kotlin/dataframe/blob/80e346f2797cd6a27afe249cc9315dbaa9a9aaa6/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/TypeConversions.kt#L254) are ["force resolved"](https://github.com/Kotlin/dataframe/blob/80e346f2797cd6a27afe249cc9315dbaa9a9aaa6/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/columns/DataColumnInternal.kt#L20), meaning regardless of their data, they will be used as a query in a dataframe (afaik).

This can cause unexpected behavior:
```kotlin
val df = dataFrameOf("a")(1, 2, 3)

val aColumnAccessor = column("a")
df.select { aColumnAccessor } // results in 1, 2, 3

val directColumn = columnOf(4, 5, 6) named "a"
df.select { directColumn } // results in 1, 2, 3

val otherDfColumn = dataFrameOf("a")(4, 5, 6)["a"]
df.select { otherDfColumn } // results in 4, 5, 6
```

This is probably related to https://github.com/Kotlin/dataframe/issues/442

Contributor guide

Open the contributing guide

Research direction

Start with DataColumnInternal.kt and the constructor entry points in constructors.kt and TypeConversions.kt, then reproduce the three select examples from the issue. Done means columns created through columnOf(), column(Iterable), and Iterable.toColumn() no longer all resolve as dataframe queries, while the shown accessor, direct-column, and other-dataframe-column cases produce their intended values.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.