Add KDocs for `DataRowApi` functions
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 1.1k
- Forks
- 83
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 30
Description
Add KDocs for DataRowApi functions
The file core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt is partially documented. Add concise KDocs for the non-deprecated members that still lack them, excluding deprecated / @AccessApiOverload overloads.
Already documented (leave as-is)
diff(all 4 overloads) anddiffOrNull(all 4) — shared anchorsDiffDocs/DiffOrNullDocs.prev(),next().
⚠️ Bug to fix while here: the
next()KDoc@returnline is wrong — it says "Returns the previous [DataRow] … ornullif the current row is the last" (copy-pasted fromprev()). Correct it to "next".
Scope — not documented (grouped)
- Row values —
valuesOf<R>(),namedValues(),namedValuesOf<R>(),getValue<T>(columnName),getValueOrNull<T>(columnName). NameValuePairschema — theNameValuePairdata class and thename/valueaccessor properties onColumnsContainer<NameValuePair<*>>/DataRow<NameValuePair<*>>.- Membership —
containsKey(columnName),contains(column)operator. - Row metadata —
columnsCount(),columnNames(),columnTypes(). - Navigation / windowing —
relative(Iterable<Int>),relative(IntRange),movingAverage(k, expression).
Out of scope: deprecated isEmpty / isNotEmpty, the deprecated getRow / getRows / getRowOrNull shortcuts, and all deprecated ColumnReference / KProperty overloads of getValue / getValueOrNull / containsKey / contains.
KDocs should explain
getValuevsgetValueOrNull: both look up a value by column name and cast toT;getValuethrows if the column is missing,getValueOrNullreturnsnull. Note the unchecked cast toT.valuesOfvsnamedValues/namedValuesOf:valuesOf<R>()returns the row's values filtered to typeR;namedValues()returns all(name, value)pairs asNameValuePair<Any?>;namedValuesOf<R>()returns only the pairs whose value isR.NameValuePair: it is the result schema oftranspose/namedValues*; document thename/valueaccessors and why they exist (sorow.transpose().name/.valueresolve).- Metadata accessors:
columnsCount/columnNames/columnTypesdescribe the owningDataFrame's columns as seen from the row. relative: returns a sub-DataFrameof rows at offsets relative to the current row index, clamped to valid bounds (out-of-range offsets are dropped).movingAverage(k, ...)averages the expression over the current and previousk-1rows.
Recommendations — make these KDocs genuinely useful (for users and for agents reading the source)
- First sentence states the contract, standalone — what it returns and the key condition; it's what IDE quick-doc and an agent's context both read first.
- Always give
@throws/ explicit-nullbehavior — pairgetValue(throws) withgetValueOrNull(returnsnull) so the reader picks the right one without reading the body. - Disambiguate the value-listing trio (
valuesOf/namedValues/namedValuesOf) by what is filtered and what is returned; one line each beats generic prose. - Cross-link with
@seethe pairs and relatives:getValue↔getValueOrNull,prev↔next,relative↔movingAverage,namedValues↔transpose/NameValuePair. - One minimal example per family using a canonical
dfrow (e.g.df[0].getValue<Int>("age")), showing the resulting type in a comment. - Name concrete types with links (
[NameValuePair],[DataRow],[KType]) rather than "a value"/"a pair". - Call out non-obvious edges the signature hides: the unchecked
as Tcast ingetValue*;relativeclamping/dropping out-of-range offsets;movingAveragedividing by the actual count near the start of the frame. - Don't restate the signature — add the semantics types can't express.
Acceptance criteria
- All members listed under Scope have concise KDocs; the already-documented
diff/diffOrNull/prev/nextare preserved. - The
next()@returncopy-paste bug is fixed. getValue/getValueOrNulldocument throw-vs-nulland the unchecked cast; the value-listing trio is clearly disambiguated.- Related members are
@see-linked. - No documentation is added for deprecated /
@AccessApiOverloadoverloads.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt by reviewing the existing KDocs for diff, prev, and next, then inspect each in-scope member and its implementation. Add concise KDocs, examples, links, and the specified null, exception, casting, and boundary behavior; correct next() and verify deprecated and @AccessApiOverload members remain undocumented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100