Skip to content

explode docs and tests #1291

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

Merged
merged 3 commits into from
Jul 3, 2025
Merged

explode docs and tests #1291

merged 3 commits into from
Jul 3, 2025

Conversation

AndreiKingsley
Copy link
Collaborator

@AndreiKingsley AndreiKingsley commented Jul 1, 2025

Close #1277

@Jolanrensen Jolanrensen changed the title explode docs and tests explode docs and tests Jul 1, 2025
@Jolanrensen Jolanrensen self-requested a review July 3, 2025 13:05
Copy link
Collaborator

@Jolanrensen Jolanrensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice :) Thanks!

Now you can probably also link from Gather.explodeLists to here or to the website, as it's the same sort of operation.

selector: ColumnsSelector<T, *> = defaultExplodeColumns,
): DataFrame<T> = toDataFrame().explode(dropEmpty, selector)

columns: ColumnsSelector<T, *> = defaultExplodeColumns,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While renaming an argument might not break binary compatibility, it will break source compatibility in some cases. However, as it's almost never named explicitly I think we can let it slide :) This Kotlinconf talk mentions something about compatibility levels if you're interested in them https://youtu.be/JKLqQiYh8GQ?si=gF5LkFq5vAPAxSIG&t=358


/**
* Splits list-like values in the specified [\columns] and spreads them vertically —
* that is, adds a separate row for each element (one value per row).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*it adds

* If no [\columns] are specified, all columns (at any depth) containing
* [List] or [DataFrame] values will be exploded.
*
* If [dropEmpty] is `true`, rows with empty lists or DataFrames will be removed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either link to [DataFrame] if you want to specifically mention an instance of the class, or write "dataframes"

* ### This `explode` overload
*/
@ExcludeFromSources
internal interface ExplodeDocs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very clear :)

@@ -43,11 +115,73 @@ public fun <T, C> DataFrame<T>.explode(vararg columns: KProperty<C>, dropEmpty:

// region explode DataRow

/**
* Splits list-like values in the specified [\columns] of this [DataRow] and spreads them vertically —
* that is, adds a separate row for each element (one value per row)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*it adds

@AndreiKingsley AndreiKingsley merged commit 5449da2 into master Jul 3, 2025
3 checks passed
@AndreiKingsley AndreiKingsley deleted the explode_kdocs branch July 3, 2025 14:29
override val Arguments.startingSchema get() = receiver

override fun Arguments.interpret(): PluginDataFrameSchema {
val columns = selector ?: object : ColumnsResolver {
val columns = columns ?: object : ColumnsResolver {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndreiKingsley @koperagen make sure to sync this with the actual compiler plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add KDocs and unit-tests for function explode
2 participants