Skip to content

Add KDoc for ColumnAccessor.nullable #1996

Description

@zaleslaw

Add KDoc for ColumnAccessor.nullable

The single public function in core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnAccessorApi.kt has no KDoc. Add one.

Scope

  • ColumnAccessor<T>.nullable(): ColumnAccessor<T?> — a compile-time cast that retypes a column accessor's element type as nullable.

Recommended KDoc (ready to use)

/**
 * Marks this [ColumnAccessor]'s element type as nullable, converting a
 * [ColumnAccessor]`<T>` into a [ColumnAccessor]`<T?>`.
 *
 * Purely a compile-time cast: no values are changed or checked. Use it when you
 * declare a typed accessor for a column that can actually contain `null`s, so that
 * reading through it gives you `T?` instead of `T` and the compiler forces you to
 * handle the `null` case.
 *
 * ### Example
 * ```kotlin
 * // A column of scores where some rows may be missing:
 * val score by column<Double>().nullable()   // ColumnAccessor<Double?>
 *
 * df.filter { score() != null && score()!! > 0.5 }
 * ```
 *
 * @receiver A typed accessor for a column of `T`.
 * @return The same accessor retyped as [ColumnAccessor]`<T?>`.
 * @see castToNullable
 */
public inline fun <reified T> ColumnAccessor<T>.nullable(): ColumnAccessor<T?> = cast()

Acceptance criteria

  • ColumnAccessor.nullable() has a concise KDoc stating it is a compile-time cast (no data change/check), when to use it, and includes an example.
  • The @see castToNullable cross-reference is kept only if it resolves and is useful for navigation; otherwise drop it.

Metadata

Metadata

Assignees

Labels

KDocsImprovements or additions to KDocs

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions