Skip to content

Commit 37ca771

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

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

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

Lines changed: 39 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,27 @@ 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+
48+
interface DISTINCT_RETURN
4449
}
4550

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

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

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

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

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

88105
/**
89106
* {@include [DistinctDocs]}
107+
* {@set NAME DistinctBy}
90108
* {@set PHRASE_ENDING the specified columns}.
109+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
110+
* The names of the columns to consider for evaluating distinct rows.}
91111
*/
92112
@Deprecated(DEPRECATED_ACCESS_API)
93113
@AccessApiOverload
@@ -96,13 +116,19 @@ public fun <T> DataFrame<T>.distinctBy(vararg columns: KProperty<*>): DataFrame<
96116

97117
/**
98118
* {@include [DistinctDocs]}
119+
* {@set NAME DistinctBy}
99120
* {@set PHRASE_ENDING the specified columns}.
121+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
122+
* The names of the columns to consider for evaluating distinct rows.}
100123
*/
101124
public fun <T> DataFrame<T>.distinctBy(vararg columns: String): DataFrame<T> = distinctBy { columns.toColumnSet() }
102125

103126
/**
104127
* {@include [DistinctDocs]}
128+
* {@set NAME DistinctBy}
105129
* {@set PHRASE_ENDING the specified columns}.
130+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
131+
* The names of the columns to consider for evaluating distinct rows.}
106132
*/
107133
@Deprecated(DEPRECATED_ACCESS_API)
108134
@AccessApiOverload
@@ -111,7 +137,10 @@ public fun <T> DataFrame<T>.distinctBy(vararg columns: AnyColumnReference): Data
111137

112138
/**
113139
* {@include [DistinctDocs]}
140+
* {@set NAME DistinctBy}
114141
* {@set PHRASE_ENDING the specified columns}.
142+
* {@set [DistinctDocs.DISTINCT_PARAM] @param [columns]
143+
* The names of the columns to consider for evaluating distinct rows.}
115144
*/
116145
public fun <T, C> DataFrame<T>.distinctBy(columns: ColumnsSelector<T, C>): DataFrame<T> {
117146
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)