Skip to content

Substitute type parameters with type arguments in toDataFrame conversion#1772

Open
koperagen wants to merge 1 commit intomasterfrom
todataframe-type-parameters
Open

Substitute type parameters with type arguments in toDataFrame conversion#1772
koperagen wants to merge 1 commit intomasterfrom
todataframe-type-parameters

Conversation

@koperagen
Copy link
Copy Markdown
Collaborator

fixes #1771

Includes little experiment with custom asserters for dataframe shape

@koperagen koperagen self-assigned this Mar 26, 2026
@koperagen koperagen added this to the 1.0.0-Beta6 milestone Mar 26, 2026
@koperagen koperagen added the bug Something isn't working label Mar 26, 2026
@koperagen koperagen requested a review from Jolanrensen March 26, 2026 15:36
internal fun KType.typeParametersSubstitution(): Map<KTypeParameter, KType> {
val klass = classifier as? KClass<*> ?: return emptyMap()
return klass.typeParameters.zip(arguments).mapNotNull { (param, projection) ->
projection.type?.let { param to it }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there seems to be a failing test regarding nullable int arrays not being recognized as nullable now, please check


fun DataFrame<*>.shouldHaveFrameColumn(
name: String,
block: (FrameColumn<*>) -> Unit = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd simply write this as = {},, this multiline looks a bit odd

},
): ColumnGroup<*> = getColumnOrNull(name).shouldBeInstanceOf<ColumnGroup<*>>(block)

fun DataFrame<*>.shouldHaveFrameColumn(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are cool! :) maybe put them somewhere in a utils file though, that way we can reuse them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toDataFrame loses types of properties with type parameter return type

2 participants