Skip to content

Commit df41f37

Browse files
Automated commit of generated code
1 parent 7a58c5d commit df41f37

File tree

11 files changed

+62
-41
lines changed

11 files changed

+62
-41
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/CandidateForRemoval.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
88
import org.jetbrains.kotlinx.dataframe.DataRow
99
import org.jetbrains.kotlinx.dataframe.RowExpression
1010
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
11-
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
1211
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
1312
import org.jetbrains.kotlinx.dataframe.annotations.RequiredByIntellijPlugin
1413
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
@@ -19,14 +18,22 @@ import org.jetbrains.kotlinx.dataframe.indices
1918
import org.jetbrains.kotlinx.dataframe.ncol
2019
import org.jetbrains.kotlinx.dataframe.nrow
2120
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
21+
import org.jetbrains.kotlinx.dataframe.util.GET_ROWS_ITERABLE_REPLACE
22+
import org.jetbrains.kotlinx.dataframe.util.GET_ROWS_RANGE_REPLACE
23+
import org.jetbrains.kotlinx.dataframe.util.GET_ROW_OR_NULL_REPLACE
24+
import org.jetbrains.kotlinx.dataframe.util.GET_ROW_REPLACE
25+
import org.jetbrains.kotlinx.dataframe.util.IS_EMPTY_REPLACE
26+
import org.jetbrains.kotlinx.dataframe.util.IS_NOT_EMPTY_REPLACE
27+
import org.jetbrains.kotlinx.dataframe.util.MESSAGE_SHORTCUT
2228
import kotlin.experimental.ExperimentalTypeInference
2329
import kotlin.reflect.KProperty
2430
import kotlin.reflect.KType
2531

26-
@CandidateForRemoval
32+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(IS_EMPTY_REPLACE), DeprecationLevel.WARNING)
2733
public fun AnyRow.isEmpty(): Boolean = owner.columns().all { it[index] == null }
2834

29-
@CandidateForRemoval
35+
@Suppress("DEPRECATION_ERROR")
36+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(IS_NOT_EMPTY_REPLACE), DeprecationLevel.WARNING)
3037
public fun AnyRow.isNotEmpty(): Boolean = !isEmpty()
3138

3239
public inline fun <reified R> AnyRow.valuesOf(): List<R> = values().filterIsInstance<R>()
@@ -198,35 +205,50 @@ public fun AnyRow.columnNames(): List<String> = df().columnNames()
198205

199206
public fun AnyRow.columnTypes(): List<KType> = df().columnTypes()
200207

201-
@CandidateForRemoval
208+
@Suppress("DEPRECATION_ERROR")
209+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(GET_ROW_REPLACE), DeprecationLevel.WARNING)
202210
public fun <T> DataRow<T>.getRow(index: Int): DataRow<T> = getRowOrNull(index)!!
203211

204-
@CandidateForRemoval
212+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(GET_ROWS_ITERABLE_REPLACE), DeprecationLevel.WARNING)
205213
public fun <T> DataRow<T>.getRows(indices: Iterable<Int>): DataFrame<T> = df().getRows(indices)
206214

207-
@CandidateForRemoval
215+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(GET_ROWS_RANGE_REPLACE), DeprecationLevel.WARNING)
208216
public fun <T> DataRow<T>.getRows(indices: IntRange): DataFrame<T> = df().getRows(indices)
209217

210-
@CandidateForRemoval
218+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(GET_ROW_OR_NULL_REPLACE), DeprecationLevel.WARNING)
211219
public fun <T> DataRow<T>.getRowOrNull(index: Int): DataRow<T>? {
212220
val df = df()
213221
return if (index >= 0 && index < df.nrow) df[index] else null
214222
}
215223

224+
/**
225+
* Returns the previous [row][DataRow] in the [DataFrame] relative to the current row.
226+
* If the current row is the first row in the [DataFrame], it returns `null`.
227+
*
228+
* @return The previous [DataRow] if it exists, or `null` if the current row is the first in the [DataFrame].
229+
*/
216230
public fun <T> DataRow<T>.prev(): DataRow<T>? {
217231
val index = index()
218232
return if (index > 0) df()[index - 1] else null
219233
}
220234

235+
/**
236+
* Returns the next [row][DataRow] in the [DataFrame] relative to the current row.
237+
* If the current row is the last row in the [DataFrame], it returns `null`.
238+
*
239+
* @return The previous [DataRow] if it exists, or `null` if the current row is the last in the [DataFrame].
240+
*/
221241
public fun <T> DataRow<T>.next(): DataRow<T>? {
222242
val index = index()
223243
val df = df()
224244
return if (index < df.nrow - 1) df[index + 1] else null
225245
}
226246

247+
@Suppress("DEPRECATION_ERROR")
227248
public fun <T> DataRow<T>.relative(relativeIndices: Iterable<Int>): DataFrame<T> =
228249
getRows(relativeIndices.mapNotNull { (index + it).let { if (it >= 0 && it < df().rowsCount()) it else null } })
229250

251+
@Suppress("DEPRECATION_ERROR")
230252
public fun <T> DataRow<T>.relative(relativeIndices: IntRange): DataFrame<T> =
231253
getRows(
232254
(relativeIndices.first + index).coerceIn(df().indices)..(relativeIndices.last + index).coerceIn(df().indices),
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package org.jetbrains.kotlinx.dataframe.api
22

33
import org.jetbrains.kotlinx.dataframe.DataFrame
4-
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
4+
import org.jetbrains.kotlinx.dataframe.util.COPY_REPLACE
5+
import org.jetbrains.kotlinx.dataframe.util.MESSAGE_SHORTCUT
6+
57
// region DataFrame
68

7-
@CandidateForRemoval
9+
@Deprecated(MESSAGE_SHORTCUT, ReplaceWith(COPY_REPLACE), DeprecationLevel.WARNING)
810
public fun <T> DataFrame<T>.copy(): DataFrame<T> = columns().toDataFrame().cast()
911

1012
// endregion

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/merge.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public fun <T, C, R> Merge<T, C, R>.intoList(): List<R> =
9090
public fun <T, C, R> MergeWithTransform<T, C, R>.intoList(): List<R> =
9191
df.select(selector).rows().map { transform(it, it.values() as List<C>) }
9292

93+
@Suppress("DEPRECATION_ERROR")
9394
public fun <T, C, R> MergeWithTransform<T, C, R>.into(path: ColumnPath): DataFrame<T> {
9495
// If target path exists, merge into temp path
9596
val mergePath = if (df.getColumnOrNull(path) != null) {

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/move.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import org.jetbrains.kotlinx.dataframe.ColumnSelector
66
import org.jetbrains.kotlinx.dataframe.ColumnsSelector
77
import org.jetbrains.kotlinx.dataframe.DataFrame
88
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
9-
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
109
import org.jetbrains.kotlinx.dataframe.annotations.Interpretable
1110
import org.jetbrains.kotlinx.dataframe.annotations.Refine
1211
import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup
@@ -834,9 +833,20 @@ public fun <T, C> MoveClause<T, C>.into(
834833
)
835834

836835
/**
837-
* Move a single selected column to top level with a new name
836+
* Moves the selected column, previously specified with [move],
837+
* to the top level of the [DataFrame] and assigns it a new name.
838+
*
839+
* For more information, see [See `move` on the documentation website.](https://kotlin.github.io/dataframe/move.html).
840+
*
841+
* ### Example:
842+
* ```kotlin
843+
* // Move "info"."salary" column to the top level with a new name "income"
844+
* df.move { info.salary }.into("income")
845+
* ```
846+
*
847+
* @param column The new [String] name of the column after the move.
848+
* @return A new [DataFrame] with the column moved and renamed.
838849
*/
839-
@CandidateForRemoval
840850
@Refine
841851
@Interpretable("MoveInto0")
842852
public fun <T, C> MoveClause<T, C>.into(column: String): DataFrame<T> = pathOf(column).let { path -> into { path } }

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/modes/aggregateBy.kt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,15 @@ package org.jetbrains.kotlinx.dataframe.impl.aggregation.modes
22

33
import org.jetbrains.kotlinx.dataframe.DataColumn
44
import org.jetbrains.kotlinx.dataframe.DataFrame
5-
import org.jetbrains.kotlinx.dataframe.DataFrameExpression
65
import org.jetbrains.kotlinx.dataframe.DataRow
76
import org.jetbrains.kotlinx.dataframe.RowExpression
8-
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
9-
import org.jetbrains.kotlinx.dataframe.api.GroupBy
10-
import org.jetbrains.kotlinx.dataframe.api.Grouped
117
import org.jetbrains.kotlinx.dataframe.api.asSequence
12-
import org.jetbrains.kotlinx.dataframe.api.cast
138
import org.jetbrains.kotlinx.dataframe.api.getOrNull
149
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
15-
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregateInternal
1610
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregator
1711
import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.indexOfAggregationResult
18-
import org.jetbrains.kotlinx.dataframe.impl.namedValues
1912
import kotlin.reflect.typeOf
2013

21-
@CandidateForRemoval
22-
internal fun <T> Grouped<T>.aggregateByOrNull(body: DataFrameExpression<T, DataRow<T>?>): DataFrame<T> {
23-
require(this is GroupBy<*, T>)
24-
val keyColumns = keys.columnNames().toSet()
25-
return aggregateInternal {
26-
val row = body(df, df)
27-
row?.namedValues()?.forEach {
28-
if (!keyColumns.contains(it.name)) yield(it)
29-
}
30-
}.cast()
31-
}
32-
3314
/**
3415
* Selects the best matching value in the [sequence][values]
3516
* using the provided [Aggregator] `by` the provided [selector].

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ internal const val ADD_VARARG_COLUMNS_REPLACE = "this.addAll(*columns)"
249249
internal const val ADD_VARARG_FRAMES = "Deprecated in favor of `addAll(vararg)` to improve completion. $MESSAGE_1_1"
250250
internal const val ADD_VARARG_FRAMES_REPLACE = "this.addAll(*dataFrames)"
251251

252+
internal const val IS_EMPTY_REPLACE = "values().all { it == null }"
253+
internal const val IS_NOT_EMPTY_REPLACE = "values().any { it != null }"
254+
internal const val GET_ROW_REPLACE = "df().getRow(index)"
255+
internal const val GET_ROWS_ITERABLE_REPLACE = "df().getRows(indices)"
256+
internal const val GET_ROWS_RANGE_REPLACE = "df().getRows(indices)"
257+
internal const val GET_ROW_OR_NULL_REPLACE = "df().getRowOrNull(index)"
258+
internal const val COPY_REPLACE = "columns().toDataFrame().cast()"
259+
252260
// endregion
253261

254262
// region keep across releases

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ConstructorsTests {
8787
col.type() shouldBe typeOf<AnyRow>()
8888
col.kind() shouldBe ColumnKind.Group
8989
col[0] shouldBe row
90+
@Suppress("DEPRECATION_ERROR")
9091
col[1].isEmpty() shouldBe true
9192
}
9293

@@ -103,7 +104,9 @@ class ConstructorsTests {
103104
col.type() shouldBe typeOf<AnyRow>()
104105
col.kind() shouldBe ColumnKind.Group
105106
col[0] shouldBe row
107+
@Suppress("DEPRECATION_ERROR")
106108
col[1]!!.isEmpty() shouldBe true
109+
@Suppress("DEPRECATION_ERROR")
107110
col[2]!!.isEmpty() shouldBe true
108111
}
109112

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/statistics/sum.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class SumTests {
117117
}
118118
}
119119

120+
@Suppress("DEPRECATION_ERROR")
120121
@Test
121122
fun `unknown number type`() {
122123
columnOf(1.toBigDecimal(), 2.toBigDecimal()).toDataFrame()

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/DataFrameTests.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,6 +2464,7 @@ class DataFrameTests : BaseTest() {
24642464
df.comparableNothing.valuesAreComparable() shouldBe false
24652465
}
24662466

2467+
@Suppress("DEPRECATION_ERROR")
24672468
// https://github.com/Kotlin/dataframe/pull/1077#discussion_r1981352374
24682469
@Test
24692470
fun `values are comparable difficult`() {

0 commit comments

Comments
 (0)