From fa2be6b4b77a5a3867572a67a53efd8d4a63ed69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 10:49:16 +0000 Subject: [PATCH 1/2] Initial plan From 8b1076ed28aa7a418dd628f13e0a12a52f619a92 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:00:07 +0000 Subject: [PATCH 2/2] Deprecate constructor-style column accessors in favor of col APIs --- .../kotlinx/dataframe/api/constructors.kt | 12 ++++++++++++ .../org/jetbrains/kotlinx/dataframe/api/col.kt | 15 +++++++++++++++ .../jetbrains/kotlinx/dataframe/api/colGroup.kt | 15 +++++++++++++++ docs/StardustDocs/topics/concepts/StringApi.md | 2 ++ 4 files changed, 44 insertions(+) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt index f0aa00995c..0bd7c3f9b8 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt @@ -44,8 +44,10 @@ import kotlin.reflect.typeOf public fun column(): ColumnDelegate = ColumnDelegate() +@Deprecated("Use col(name) instead.", ReplaceWith("col(name)")) public fun column(name: String): ColumnAccessor = ColumnAccessorImpl(name) +@Deprecated("Use col(path) instead.", ReplaceWith("col(path)")) public fun column(path: ColumnPath): ColumnAccessor = ColumnAccessorImpl(path) @Deprecated(DEPRECATED_ACCESS_API) @@ -54,8 +56,10 @@ public fun column(property: KProperty): ColumnAccessor = ColumnAccesso public fun ColumnGroupReference.column(): ColumnDelegate = ColumnDelegate(this) +@Deprecated("Use col(name) instead.", ReplaceWith("this.col(name)")) public fun ColumnGroupReference.column(name: String): ColumnAccessor = ColumnAccessorImpl(path() + name) +@Deprecated("Use col(path) instead.", ReplaceWith("this.col(path)")) public fun ColumnGroupReference.column(path: ColumnPath): ColumnAccessor = ColumnAccessorImpl(this.path() + path) @Deprecated(DEPRECATED_ACCESS_API) @@ -131,14 +135,18 @@ public fun columnGroup(): ColumnDelegate> = column() @JvmName("columnGroupTyped") public fun columnGroup(): ColumnDelegate> = column() +@Deprecated("Use colGroup(name) instead.", ReplaceWith("colGroup(name)")) public fun columnGroup(name: String): ColumnAccessor> = column(name) @JvmName("columnGroupTyped") +@Deprecated("Use colGroup(name) instead.", ReplaceWith("colGroup(name)")) public fun columnGroup(name: String): ColumnAccessor> = column(name) +@Deprecated("Use colGroup(path) instead.", ReplaceWith("colGroup(path)")) public fun columnGroup(path: ColumnPath): ColumnAccessor> = column(path) @JvmName("columnGroupTyped") +@Deprecated("Use colGroup(path) instead.", ReplaceWith("colGroup(path)")) public fun columnGroup(path: ColumnPath): ColumnAccessor> = column(path) @JvmName("columnGroupDataRowKProperty") @@ -155,17 +163,21 @@ public fun ColumnGroupReference.columnGroup(): ColumnDelegate> = Colu @JvmName("columnGroupTyped") public fun ColumnGroupReference.columnGroup(): ColumnDelegate> = ColumnDelegate(this) +@Deprecated("Use colGroup(name) instead.", ReplaceWith("this.colGroup(name)")) public fun ColumnGroupReference.columnGroup(name: String): ColumnAccessor> = ColumnAccessorImpl(path() + name) @JvmName("columnGroupTyped") +@Deprecated("Use colGroup(name) instead.", ReplaceWith("this.colGroup(name)")) public fun ColumnGroupReference.columnGroup(name: String): ColumnAccessor> = ColumnAccessorImpl(path() + name) +@Deprecated("Use colGroup(path) instead.", ReplaceWith("this.colGroup(path)")) public fun ColumnGroupReference.columnGroup(path: ColumnPath): ColumnAccessor> = ColumnAccessorImpl(this.path() + path) @JvmName("columnGroupTyped") +@Deprecated("Use colGroup(path) instead.", ReplaceWith("this.colGroup(path)")) public fun ColumnGroupReference.columnGroup(path: ColumnPath): ColumnAccessor> = ColumnAccessorImpl(this.path() + path) diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt index 25cc6c27ec..1654ac99f9 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt @@ -51,6 +51,21 @@ class ColTests : ColumnsSelectionDslTests() { ).shouldAllBeEqual() } + @Test + @Suppress("DEPRECATION") + fun `column constructors are aliases of col`() { + listOf( + df.select { col("age") }, + df.select { column("age") }, + df.select { col("age") }, + df.select { column("age") }, + df.select { col(pathOf("age")) }, + df.select { column(pathOf("age")) }, + df.select { col(pathOf("age")) }, + df.select { column(pathOf("age")) }, + ).shouldAllBeEqual() + } + @Test fun `col at lower level`() { val firstNameAccessor = column("firstName") diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt index 293ed61dee..add1847fa0 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt @@ -44,6 +44,21 @@ class ColGroupTests : ColumnsSelectionDslTests() { ).shouldAllBeEqual() } + @Test + @Suppress("DEPRECATION") + fun `columnGroup constructors are aliases of colGroup`() { + listOf( + dfGroup.select { colGroup("name") }, + dfGroup.select { columnGroup("name") }, + dfGroup.select { colGroup("name") }, + dfGroup.select { columnGroup("name") }, + dfGroup.select { colGroup(pathOf("name")) }, + dfGroup.select { columnGroup(pathOf("name")) }, + dfGroup.select { colGroup(pathOf("name")) }, + dfGroup.select { columnGroup(pathOf("name")) }, + ).shouldAllBeEqual() + } + @Test fun `frameCol at lower level`() { val firstNamesAccessor = columnGroup("firstName") diff --git a/docs/StardustDocs/topics/concepts/StringApi.md b/docs/StardustDocs/topics/concepts/StringApi.md index 1d30c204f3..b46e96294b 100644 --- a/docs/StardustDocs/topics/concepts/StringApi.md +++ b/docs/StardustDocs/topics/concepts/StringApi.md @@ -41,6 +41,8 @@ via *`String` column accessors*. or with any other [CS DSL methods](ColumnSelectors.md#functions-overview). String column accessors are created using special functions. +Use `col(...)` and `colGroup(...)` as the canonical accessor constructors. +Legacy `column(...)` and `columnGroup(...)` constructor aliases are kept for backward compatibility. In the Columns Selection DSL, they have the special type `ColumnAccessor`, while in row expressions they resolve to concrete value types.