-
Notifications
You must be signed in to change notification settings - Fork 69
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
NullPointerException
using except
to exclude double nested column
#761
Comments
Let's consider making except work only for selected columns and not their children |
Yes, that might be a good idea. Many operations can be reproduced with
Eventually, we might want another way to be able to select a column and keep its parents structure (so select its parents, but delete its siblings). But we can sorta reproduce that already by doing something like: df.getColumnsWithPaths { colsAtAnyDepth().colsOf<Int>() }
.map { it.path to it }
.toDataFrameFromPairs<Any?>() |
Not sure if this is a |
This is another failing example: val renamed = df.rename { colsAtAnyDepth() except name.firstName }.into { it.name.uppercase() }
renamed.columnNames() shouldBe listOf("NAME", "AGE", "CITY", "WEIGHT", "ISHAPPY")
renamed.getColumnGroup("NAME").columnNames() shouldBe listOf("firstName", "LASTNAME") The result is |
Nullpointer can be avoided by: @Suppress("UNNECESSARY_NOT_NULL_ASSERTION")
var currentNode = nodeToExcept.parent!!
while (parent != null) {
val parentData = parent.data as ColumnGroup<*>? ?: break
val currentData = currentNode.data
parent.data =
if (currentData == null) {
parentData.remove(currentNode.name)
} else {
parentData.replace(currentNode.name).with { currentData }
}.asColumnGroup(parentData.name)
.addPath(parentData.path())
currentNode = parent
parent = parent.parent
} but this doesn't fix #761 (comment) |
To reproduce:
This works:
This breaks:
The text was updated successfully, but these errors were encountered: