Kotlin / Kotlin/dataframe

Notebooks fail with `T : Comparable<T & Any>?` notation

Open
#1,116 3 comments 0 reactions 1 assignee Claimed by @Jolanrensen View on GitHub
bug
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Introduced by https://github.com/Kotlin/dataframe/pull/1108

`min`, `max`, `median`, and `percentile` in notebooks (k1) throw `"IllegalStateException: null DefinitelyNotNullType for 'T'", exception while analyzing expression`

This cannot be fixed on our side but is tracked [here: KT-76441](https://youtrack.jetbrains.com/issue/KT-76441/IllegalStateException-null-DefinitelyNotNullType-for-T-exception-while-analyzing-expression).

I tried bumping to Kotlin 2.1.20, but that didn't help.

It should be fixed once [k2 mode works in notebooks](https://youtrack.jetbrains.com/issue/KTNB-811/K2-List-of-known-issues) and Dataframe works in it as well (there are some known issues with extension properties, and [service loaders](https://youtrack.jetbrains.com/issue/KTNB-1008/K2-Repl-Problems-using-ServiceLoader-in-DataFrame) for instance).

If you need to use these functions in your notebook, you can try this dev version:
`%use dataframe(v=1.0.0-dev-7089)`.
It removes the `& Any` return type by making the functions not allow nullable columns at all, avoiding the issue.

I created a [shortcut](https://github.com/Kotlin/kotlin-jupyter-libraries/tree/kc25) for KotlinConf 2025 which use:
- dataframe 1.0.0-dev-7089
- kandy 0.8.1-dev-67
- kandy stats 0.4.2-dev-2

Simply write: `%use dataframe@kc25, kandy@kc25, kandy-geo@kc25`

`SampleNotebooksTests` temporarily ignore this exception.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.