We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
DynamicDataFrameBuilder
I can't rewrite this code with DynamicDataFrameBuilder: https://github.com/Kotlin/kandy/blob/2764bce7e9eec4888fdce71b306631cd4e0a208c/kandy-api/src/main/kotlin/org/jetbrains/kotlinx/kandy/dsl/internal/DatasetHandler.kt#L116 Here I want to do the following - if the column I want to add is already in the builder (with the same name and contains the same elements), it shouldn't be added again.
The text was updated successfully, but these errors were encountered:
Indeed it might be worth it to add a contains(col): Boolean function to DynamicDataFrameBuilder.
contains(col): Boolean
DynamicDataFrameBuilder
Could you try whether this works?
public operator fun DynamicDataFrameBuilder.contains(col: AnyCol): Boolean = toDataFrame().getColumnOrNull(col) == col
Column equality in DataFrame is checked by this function:
internal fun <T> BaseColumn<T>.checkEquals(other: Any?): Boolean { if (this === other) return true if (this !is AnyCol) return false if (other !is AnyCol) return false if (name != other.name) return false if (type != other.type) return false return values.equalsByElement(other.values) }
So it checks the name and values by default when you use colA == colB
colA == colB
Sorry, something went wrong.
I guess it should work, but it's not efficient in terms of performance. So yeah, contains will work I suppose.
contains
@AndreiKingsley you can make a PR that adds the function to DynamicDataFrameBuilder if you like :)
Ok
@AndreiKingsley will be great if you have a look at this issue during next release cycle
AndreiKingsley
No branches or pull requests
I can't rewrite this code with
DynamicDataFrameBuilder
:https://github.com/Kotlin/kandy/blob/2764bce7e9eec4888fdce71b306631cd4e0a208c/kandy-api/src/main/kotlin/org/jetbrains/kotlinx/kandy/dsl/internal/DatasetHandler.kt#L116
Here I want to do the following - if the column I want to add is already in the builder (with the same name and contains the same elements), it shouldn't be added again.
The text was updated successfully, but these errors were encountered: