Kotlin / Kotlin/dataframe

FrameColumn.schema can produce types with redundant out variance

Open
#1,806 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Consider FrameColumn where 1 dataframe is empty, and 1 has nullability
Common schema is computed by intersectSchema.

val l = listOf(listOf(3.0))
val col1 = DataColumn.createByType("col", l)
val col2 = col1.take(0)
@Suppress("KotlinConstantConditions")
val col3 = col1.map { it.takeIf { false } }
val df = dataFrameOf(
    "frameCol" to columnOf(
        dataFrameOf(col1), dataFrameOf(col2), dataFrameOf(col3)
    )
)
df.schema().print()

It creates a type with out variance that's redundant here:

frameCol: *
    col: List<out Double>?
df.generateDataClasses().print()
Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducer in the issue and inspect intersectSchema, which computes the common schema for the empty and nullable DataFrame columns. Run the schema and generateDataClasses examples to confirm the redundant out variance, then trace the schema result to determine the expected type and verify that both outputs no longer contain the unnecessary variance.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.