Skip to content

Add column selector overloads for GroupBy.sortByKey#1768

Open
mvanhorn wants to merge 1 commit intoKotlin:masterfrom
mvanhorn:osc/1523-sortbykey-column-selector
Open

Add column selector overloads for GroupBy.sortByKey#1768
mvanhorn wants to merge 1 commit intoKotlin:masterfrom
mvanhorn:osc/1523-sortbykey-column-selector

Conversation

@mvanhorn
Copy link

Summary

Adds ColumnsSelector overloads for sortByKey and sortByKeyDesc so users can specify which key columns to sort by.

Why this matters

The existing sortByKey() sorts by all key columns with the same order. If you group by name and age but only want to sort by age, there's no way to express that without dropping down to raw sortBy.

Changes

  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sort.kt: Added two new overloads accepting ColumnsSelector<T, C>, following the same pattern as GroupBy.sortBy(selector).

Testing

  • Syntax verified
  • Follows the identical pattern as the existing sortBy/sortByDesc overloads that accept SortColumnsSelector

Fixes #1523

This contribution was developed with AI assistance (Claude Code).

Adds ColumnsSelector overloads for sortByKey and sortByKeyDesc
so users can specify which key columns to sort by instead of
sorting by all keys with the same order.

Fixes Kotlin#1523
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 column selector for GroupBy.sortByKey

1 participant