Skip to content
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

It fails to rename nullable inline value column #526

Closed
holgerbrandl opened this issue Dec 4, 2023 · 1 comment
Closed

It fails to rename nullable inline value column #526

holgerbrandl opened this issue Dec 4, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@holgerbrandl
Copy link

Expected: It should run the following example

import org.jetbrains.kotlinx.dataframe.api.*

@JvmInline
value class Speed(val kmh: Number){
}

class PathSegment(
    val id: String, val speedLimit: Speed? = null,
)


fun main() {
    val segments = listOf(PathSegment("foo", Speed(2.3)), PathSegment("bar",))

    val df = segments.toDataFrame()
    df.rename("speedLimit" to "speed_limit").print()
}

Observed: It fails with

Exception in thread "main" java.lang.NullPointerException
	at org.kalasim.scratch.Speed.hashCode-impl(InlineClassDf.kt)
	at org.kalasim.scratch.Speed.hashCode(InlineClassDf.kt)
	at org.jetbrains.kotlinx.dataframe.impl.UtilsKt.rollingHash(Utils.kt:99)
	at org.jetbrains.kotlinx.dataframe.impl.columns.UtilsKt.getHashCode(Utils.kt:39)
	at org.jetbrains.kotlinx.dataframe.impl.columns.DataColumnImpl$hashCode$2.invoke(DataColumnImpl.kt:36)
	at org.jetbrains.kotlinx.dataframe.impl.columns.DataColumnImpl$hashCode$2.invoke(DataColumnImpl.kt:36)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at org.jetbrains.kotlinx.dataframe.impl.columns.DataColumnImpl.getHashCode(DataColumnImpl.kt:36)
	at org.jetbrains.kotlinx.dataframe.impl.columns.DataColumnImpl.hashCode(DataColumnImpl.kt:38)
	at java.base/java.util.HashMap.hash(HashMap.java:340)
	at java.base/java.util.HashMap.put(HashMap.java:608)
	at org.jetbrains.kotlinx.dataframe.impl.api.RenameKt.renameImpl(rename.kt:64)
	at org.jetbrains.kotlinx.dataframe.impl.api.RenameKt.renameImpl(rename.kt:19)
	at org.jetbrains.kotlinx.dataframe.api.RenameKt.into(rename.kt:57)
	at org.jetbrains.kotlinx.dataframe.api.RenameKt.rename(rename.kt:22)
	at org.kalasim.scratch.InlineClassDfKt.main(InlineClassDf.kt:18)
	at org.kalasim.scratch.InlineClassDfKt.main(InlineClassDf.kt)

Tested version v0.12

@Jolanrensen Jolanrensen added the bug Something isn't working label Dec 4, 2023
@Jolanrensen Jolanrensen added this to the 0.13.0 milestone Dec 4, 2023
@koperagen koperagen self-assigned this Dec 4, 2023
@Jolanrensen
Copy link
Collaborator

I assume this was fixed by the PR #542

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

No branches or pull requests

3 participants