Improve tests, KDocs, and site docs for `duplicate` / `duplicateRows`
- Dominant language
- Kotlin
- Stars
- 1.1k
- Forks
- 83
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 30
Description
## Improve tests, KDocs, and site docs for `duplicate` / `duplicateRows`
`core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/duplicate.kt` contains a small set of public APIs without KDocs and without a dedicated unit test file.
The current site page is also very brief and has no data examples:
https://kotlin.github.io/dataframe/duplicate.html
These APIs duplicate rows/dataframes:
- `DataRow.duplicate(n)` returns a `DataFrame` where the row is repeated `n` times.
- `DataFrame.duplicate(n)` returns a `FrameColumn` where the dataframe is repeated `n` times.
- `DataFrame.duplicateRows(n)` repeats every row `n` times.
- `DataFrame.duplicateRows(n) { condition }` repeats only rows matching the condition.
### Scope
- Add KDocs for all public functions in `duplicate.kt`.
- Add a dedicated unit test file for `duplicate` / `duplicateRows`.
- Improve the site page with input/output tables and runnable examples.
### Test scenarios as an option
- `DataRow.duplicate(n)` repeats a single row and preserves column values.
- `DataFrame.duplicate(n)` creates a `FrameColumn` with `n` copies of the original dataframe.
- `DataFrame.duplicateRows(n)` repeats all rows in the expected order.
- `DataFrame.duplicateRows(n) { condition }` repeats only matching rows and keeps non-matching rows once.
- Nested columns / column groups are duplicated correctly.
- Edge cases for `n = 0` and `n < 0` are tested or explicitly documented, especially because behavior differs between overloads in the current implementation.
### Site docs recommendations
- Add input/output tables for `duplicateRows(n)`.
- Add an example for conditional `duplicateRows(n) { ... }`.
- Add a short example for `DataRow.duplicate(n)`.
- Add a short example for `DataFrame.duplicate(n)` returning a `FrameColumn`.
- Clearly document constraints and behavior for invalid or zero `n`.
### Acceptance criteria
- Public `duplicate` / `duplicateRows` APIs have concise KDocs.
- Dedicated unit tests cover all overloads.
- Site docs contain practical examples with input/output tables.
- Behavior for `n = 0` and `n < 0` is either consistently tested or clearly documented.
Contributor guide
Research direction
Start with core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/duplicate.kt and inspect nearby unit tests to understand each overload and its edge-case behavior. Then review the existing duplicate.html site page and add examples, input/output tables, and constraints. Done means all public APIs have KDocs, overloads have dedicated tests, and the site documents practical and invalid-input behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- documentation, testing
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100