Kotlin / Kotlin/dataframe

Add KDoc for `ColumnAccessor.nullable`

Open
#1,996 0 comments 0 reactions 1 assignee Claimed by @zaleslaw View on GitHub
KDocs
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

# 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.nullable(): ColumnAccessor` — a compile-time cast that retypes a column accessor's element type as nullable.

### Recommended KDoc (ready to use)

```kotlin
/**
* Marks this [ColumnAccessor]'s element type as nullable, converting a
* [ColumnAccessor]`` into a [ColumnAccessor]``.
*
* 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().nullable() // ColumnAccessor
*
* df.filter { score() != null && score()!! > 0.5 }
* ```
*
* @receiver A typed accessor for a column of `T`.
* @return The same accessor retyped as [ColumnAccessor]``.
* @see castToNullable
*/
public inline fun ColumnAccessor.nullable(): ColumnAccessor = 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.