Skip to content

Potential bug fix for nested types codegen jupyter #1223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jolanrensen
Copy link
Collaborator

Fixes #1222

Made it so that nested types in jupyter codegen follow their parent's openness. This makes it so that:

val df1 = dataFrameOf(
    "group" to columnOf(
        "a" to columnOf(1, null, 3),
    )
)
val df2 = dataFrameOf(
    "group" to columnOf(
        "a" to columnOf(1, 2, 3),
    )
)

produces something like:

// for df1

@DataSchema(isOpen = true)
interface _DataFrameType1 {
    val a: Int?
}

@DataSchema
interface _DataFrameType {
    val group: _DataFrameType1
}

// for df2

@DataSchema(isOpen = true)
interface _DataFrameType3 : _DataFrameType1 { // now the non-nullable variant extends the nullable variant
    override val a: Int // requires override
}

@DataSchema
interface _DataFrameType2 : _DataFrameType {
    override val group: _DataFrameType3
}

However, the old behavior (whenever a schema is generated, nested types, such as inside column groups and frame cols are generated with isOpen = false, even if the data schema itself has isOpen = true) has been like this since at least 2021.

This change makes this test fail, which indicates to me that it might have been done intentionally. @koperagen could you maybe explain a bit more about this behavior now that we know it can cause bugs like these?

@Jolanrensen Jolanrensen requested a review from koperagen May 28, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jupyter: Data schema generation bug with mixed nullability of similarly named column
1 participant