Skip to content

Commit b67f0d0

Browse files
committed
Fixes to the documentation for the distinct and distinctBy functions.
1 parent 94bbcf9 commit b67f0d0

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/distinct.kt

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package org.jetbrains.kotlinx.dataframe.api
33
import org.jetbrains.kotlinx.dataframe.AnyColumnReference
44
import org.jetbrains.kotlinx.dataframe.ColumnsSelector
55
import org.jetbrains.kotlinx.dataframe.DataFrame
6+
import org.jetbrains.kotlinx.dataframe.DataRow
67
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
78
import org.jetbrains.kotlinx.dataframe.annotations.Interpretable
89
import org.jetbrains.kotlinx.dataframe.annotations.Refine
10+
import org.jetbrains.kotlinx.dataframe.api.DistinctDocs.DISTINCT_RETURN
911
import org.jetbrains.kotlinx.dataframe.api.Select.SelectSelectingOptions
1012
import org.jetbrains.kotlinx.dataframe.columns.ColumnSet
1113
import org.jetbrains.kotlinx.dataframe.columns.SingleColumn
@@ -23,24 +25,26 @@ import kotlin.reflect.KProperty
2325
// region DataFrame
2426

2527
/**
26-
* ## The Distinct Operation
28+
* ## The {@get NAME Distinct} Operation
2729
*
28-
* It removes duplicated rows based on {@get PHRASE_ENDING}.
30+
* {@get DESCRIPTION It removes duplicated rows based on {@get PHRASE_ENDING}}.
2931
*
30-
* __NOTE:__ The rows in the resulting [DataFrame] are in the same order as they were in the original [DataFrame].
32+
* __NOTE:__ The [rows][DataRow] in the resulting [DataFrame] are in the same order
33+
* as they were in the original [DataFrame].
3134
*
32-
* {@get [DISTINCT_PARAM] @param [columns]
33-
* The names of the columns to consider for evaluating distinct rows.}
35+
* {@get [DISTINCT_PARAM]}
3436
*
35-
* @return A new DataFrame containing only distinct rows.
37+
* {@get [DISTINCT_RETURN] @return A new [DataFrame] containing only distinct rows.}
3638
*
3739
* @see [Selecting Columns][SelectSelectingOptions].
3840
* @see {@include [DocumentationUrls.Distinct]}
41+
* @see {@include [DocumentationUrls.DistinctBy]}
3942
*/
4043
@ExcludeFromSources
4144
@Suppress("ClassName")
4245
private interface DistinctDocs {
4346
interface DISTINCT_PARAM
47+
interface DISTINCT_RETURN
4448
}
4549

4650
/**
@@ -52,15 +56,21 @@ public fun <T> DataFrame<T>.distinct(): DataFrame<T> = distinctBy { all() }
5256

5357
/**
5458
* {@include [DistinctDocs]}
55-
* {@set PHRASE_ENDING the specified columns}.
59+
* {@set DESCRIPTION It selects the specified columns and keeps only distinct rows based on these selected columns}
60+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns] The names of the columns to select
61+
* and to consider for evaluating distinct rows.}
62+
* {@set [DISTINCT_RETURN] @return A new [DataFrame] containing only selected columns and distinct rows.}
5663
*/
5764
@Refine
5865
@Interpretable("Distinct0")
5966
public fun <T, C> DataFrame<T>.distinct(columns: ColumnsSelector<T, C>): DataFrame<T> = select(columns).distinct()
6067

6168
/**
6269
* {@include [DistinctDocs]}
63-
* {@set PHRASE_ENDING the specified columns}.
70+
* {@set DESCRIPTION It selects the specified columns and keeps only distinct rows based on these selected columns}
71+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns] The names of the columns to select
72+
* and to consider for evaluating distinct rows.}
73+
* {@set [DISTINCT_RETURN] @return A new [DataFrame] containing only selected columns and distinct rows.}
6474
*/
6575
@Deprecated(DEPRECATED_ACCESS_API)
6676
@AccessApiOverload
@@ -72,13 +82,19 @@ public fun <T> DataFrame<T>.distinct(vararg columns: KProperty<*>): DataFrame<T>
7282

7383
/**
7484
* {@include [DistinctDocs]}
75-
* {@set PHRASE_ENDING the specified columns}.
85+
* {@set DESCRIPTION It selects the specified columns and keeps only distinct rows based on these selected columns}
86+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns] The names of the columns to select
87+
* and to consider for evaluating distinct rows.}
88+
* {@set [DISTINCT_RETURN] @return A new [DataFrame] containing only selected columns and distinct rows.}
7689
*/
7790
public fun <T> DataFrame<T>.distinct(vararg columns: String): DataFrame<T> = distinct { columns.toColumnSet() }
7891

7992
/**
8093
* {@include [DistinctDocs]}
81-
* {@set PHRASE_ENDING the specified columns}.
94+
* {@set DESCRIPTION It selects the specified columns and keeps only distinct rows based on these selected columns}
95+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns] The names of the columns to select
96+
* and to consider for evaluating distinct rows.}
97+
* {@set [DISTINCT_RETURN] @return A new [DataFrame] containing only selected columns and distinct rows.}
8298
*/
8399
@Deprecated(DEPRECATED_ACCESS_API)
84100
@AccessApiOverload
@@ -87,7 +103,10 @@ public fun <T> DataFrame<T>.distinct(vararg columns: AnyColumnReference): DataFr
87103

88104
/**
89105
* {@include [DistinctDocs]}
106+
* {@set NAME DistinctBy}
90107
* {@set PHRASE_ENDING the specified columns}.
108+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
109+
* The names of the columns to consider for evaluating distinct rows.}
91110
*/
92111
@Deprecated(DEPRECATED_ACCESS_API)
93112
@AccessApiOverload
@@ -96,13 +115,19 @@ public fun <T> DataFrame<T>.distinctBy(vararg columns: KProperty<*>): DataFrame<
96115

97116
/**
98117
* {@include [DistinctDocs]}
118+
* {@set NAME DistinctBy}
99119
* {@set PHRASE_ENDING the specified columns}.
120+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
121+
* The names of the columns to consider for evaluating distinct rows.}
100122
*/
101123
public fun <T> DataFrame<T>.distinctBy(vararg columns: String): DataFrame<T> = distinctBy { columns.toColumnSet() }
102124

103125
/**
104126
* {@include [DistinctDocs]}
127+
* {@set NAME DistinctBy}
105128
* {@set PHRASE_ENDING the specified columns}.
129+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
130+
* The names of the columns to consider for evaluating distinct rows.}
106131
*/
107132
@Deprecated(DEPRECATED_ACCESS_API)
108133
@AccessApiOverload
@@ -111,7 +136,10 @@ public fun <T> DataFrame<T>.distinctBy(vararg columns: AnyColumnReference): Data
111136

112137
/**
113138
* {@include [DistinctDocs]}
139+
* {@set NAME DistinctBy}
114140
* {@set PHRASE_ENDING the specified columns}.
141+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
142+
* The names of the columns to consider for evaluating distinct rows.}
115143
*/
116144
public fun <T, C> DataFrame<T>.distinctBy(columns: ColumnsSelector<T, C>): DataFrame<T> {
117145
val cols = get(columns)

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ internal interface DocumentationUrls {
8787
/** <a href="{@include [Url]}/distinct.html">See `distinct` on the documentation website.</a> */
8888
interface Distinct
8989

90+
/** <a href="{@include [Url]}/distinct.html#distinctby">See `distinctBy` on the documentation website.</a> */
91+
interface DistinctBy
92+
9093
/** <a href="{@include [Url]}/flatten.html">See `flatten` on the documentation website.</a> */
9194
interface Flatten
9295

0 commit comments

Comments
 (0)