-
Notifications
You must be signed in to change notification settings - Fork 58
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
df.describe().describe()
crashes
#724
Comments
This is a very interesting bug! @Test
fun `describe twice 1`() {
val df = dataFrameOf("a", "b")(1, 2, 3, 4)
val desc1 = df.describe()
val desc2 = desc1.describe()
desc2::class shouldBe DataFrameImpl::class
} works fine, but @Test
fun `describe twice 2`() {
val df = dataFrameOf("a", "b")(1, "foo", 3, "bar")
val desc1 = df.describe()
val desc2 = desc1.describe()
desc2::class shouldBe DataFrameImpl::class
} breaks. I suspect this is due to columns being created with type
If you now run another Our current implementation only checks if a column |
@koperagen thanks for the tip! But unfortunately: typeOf<Int>().isSubtypeOf(typeOf<Comparable<Any?>>()) == false
typeOf<Int>().isSubtypeOf(typeOf<Comparable<Any>>()) == false variance is fun :) |
It can be fixed like: /**
* Returns `true` if [this] column is comparable, i.e. its type is a subtype of [Comparable] and its
* type argument is not [Nothing].
*/
public fun AnyCol.isComparable(): Boolean = isSubtypeOf<Comparable<*>?>()
&& type().projectTo(Comparable::class).arguments[0].let {
it != KTypeProjection.STAR &&
it.type?.isNothing != true
} I'll probably make a PR later :) |
…o check whether the values in the `Comparable` column are actually "comparable" aka, the generic type of Comparable is not */Nothing
Ran into this by accident while testing AI Assistant.
It looks like the output of
df.describe()
creates a DataFrame with some invalid types. I managed to reproduce crashes in two cases:I also reproduced this in a unit test:
Which crashed with:
The text was updated successfully, but these errors were encountered: