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) and diffOrNull (all 4) — shared anchors DiffDocs / DiffOrNullDocs.
prev(), next().
⚠️ Bug to fix while here: the next() KDoc @return line is wrong — it says "Returns the previous [DataRow] … or null if the current row is the last" (copy-pasted from prev()). Correct it to "next".
Scope — not documented (grouped)
- Row values —
valuesOf<R>(), namedValues(), namedValuesOf<R>(), getValue<T>(columnName), getValueOrNull<T>(columnName).
NameValuePair schema — the NameValuePair data class and the name / value accessor properties on ColumnsContainer<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
getValue vs getValueOrNull: both look up a value by column name and cast to T; getValue throws if the column is missing, getValueOrNull returns null. Note the unchecked cast to T.
valuesOf vs namedValues / namedValuesOf: valuesOf<R>() returns the row's values filtered to type R; namedValues() returns all (name, value) pairs as NameValuePair<Any?>; namedValuesOf<R>() returns only the pairs whose value is R.
NameValuePair: it is the result schema of transpose / namedValues*; document the name / value accessors and why they exist (so row.transpose().name / .value resolve).
- Metadata accessors:
columnsCount / columnNames / columnTypes describe the owning DataFrame's columns as seen from the row.
relative: returns a sub-DataFrame of 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 previous k-1 rows.
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-null behavior — pair getValue (throws) with getValueOrNull (returns null) 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
@see the pairs and relatives: getValue↔getValueOrNull, prev↔next, relative↔movingAverage, namedValues↔transpose/NameValuePair.
- One minimal example per family using a canonical
df row (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 T cast in getValue*; relative clamping/dropping out-of-range offsets; movingAverage dividing 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 / next are preserved.
- The
next() @return copy-paste bug is fixed.
getValue / getValueOrNull document throw-vs-null and the unchecked cast; the value-listing trio is clearly disambiguated.
- Related members are
@see-linked.
- No documentation is added for deprecated /
@AccessApiOverload overloads.
Add KDocs for
DataRowApifunctionsThe file
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.ktis partially documented. Add concise KDocs for the non-deprecated members that still lack them, excluding deprecated /@AccessApiOverloadoverloads.Already documented (leave as-is)
diff(all 4 overloads) anddiffOrNull(all 4) — shared anchorsDiffDocs/DiffOrNullDocs.prev(),next().Scope — not documented (grouped)
valuesOf<R>(),namedValues(),namedValuesOf<R>(),getValue<T>(columnName),getValueOrNull<T>(columnName).NameValuePairschema — theNameValuePairdata class and thename/valueaccessor properties onColumnsContainer<NameValuePair<*>>/DataRow<NameValuePair<*>>.containsKey(columnName),contains(column)operator.columnsCount(),columnNames(),columnTypes().relative(Iterable<Int>),relative(IntRange),movingAverage(k, expression).Out of scope: deprecated
isEmpty/isNotEmpty, the deprecatedgetRow/getRows/getRowOrNullshortcuts, and all deprecatedColumnReference/KPropertyoverloads ofgetValue/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).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)
@throws/ explicit-nullbehavior — pairgetValue(throws) withgetValueOrNull(returnsnull) so the reader picks the right one without reading the body.valuesOf/namedValues/namedValuesOf) by what is filtered and what is returned; one line each beats generic prose.@seethe pairs and relatives:getValue↔getValueOrNull,prev↔next,relative↔movingAverage,namedValues↔transpose/NameValuePair.dfrow (e.g.df[0].getValue<Int>("age")), showing the resulting type in a comment.[NameValuePair],[DataRow],[KType]) rather than "a value"/"a pair".as Tcast ingetValue*;relativeclamping/dropping out-of-range offsets;movingAveragedividing by the actual count near the start of the frame.Acceptance criteria
diff/diffOrNull/prev/nextare preserved.next()@returncopy-paste bug is fixed.getValue/getValueOrNulldocument throw-vs-nulland the unchecked cast; the value-listing trio is clearly disambiguated.@see-linked.@AccessApiOverloadoverloads.