Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing exceptNew: Option 1 #1030

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
300 changes: 0 additions & 300 deletions core/api/core.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -333,10 +333,6 @@ public interface ColumnsSelectionDsl<out T> : // SingleColumn<DataRow<T>>
*
* {@include [Indent]}`| `{@include [DropColumnsSelectionDsl.Grammar.ColumnGroupWhileName]}**` { `**{@include [DslGrammarTemplate.ConditionRef]}**` \}`**
*
* {@include [Indent]}`| `{@include [AllExceptColumnsSelectionDsl.Grammar.ColumnGroupExperimentalName]}**` { `**{@include [DslGrammarTemplate.ColumnsSelectorRef]}**` \} EXPERIMENTAL!`**
*
* {@include [Indent]}`| `{@include [AllExceptColumnsSelectionDsl.Grammar.ColumnGroupExperimentalName]}**`(`**{@include [DslGrammarTemplate.ColumnNoAccessorRef]}**`,`**` ..`**`) EXPERIMENTAL!`**
*
* {@include [Indent]}`| (`{@include [FirstColumnsSelectionDsl.Grammar.ColumnGroupName]}`| `{@include [LastColumnsSelectionDsl.Grammar.ColumnGroupName]}`| `{@include [SingleColumnsSelectionDsl.Grammar.ColumnGroupName]}`) [ `**`{ `**{@include [DslGrammarTemplate.ConditionRef]}**` \}`**` ]`
*
* {@include [Indent]}`| `{@include [SelectColumnsSelectionDsl.Grammar.ColumnGroupName]}**` { `**{@include [DslGrammarTemplate.ColumnsSelectorRef]}**` \}`**
387 changes: 0 additions & 387 deletions core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt
Original file line number Diff line number Diff line change
@@ -7,20 +7,16 @@ import org.jetbrains.kotlinx.dataframe.DataRow
import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup
import org.jetbrains.kotlinx.dataframe.columns.ColumnPath
import org.jetbrains.kotlinx.dataframe.columns.ColumnSet
import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath
import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver
import org.jetbrains.kotlinx.dataframe.columns.SingleColumn
import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
import org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApiLink
import org.jetbrains.kotlinx.dataframe.documentation.AccessApiLink
import org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate
import org.jetbrains.kotlinx.dataframe.documentation.Indent
import org.jetbrains.kotlinx.dataframe.documentation.LineBreak
import org.jetbrains.kotlinx.dataframe.impl.aggregation.toColumns
import org.jetbrains.kotlinx.dataframe.impl.columns.allColumnsExceptKeepingStructure
import org.jetbrains.kotlinx.dataframe.impl.columns.changePath
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet
import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE_VARARG
@@ -70,10 +66,6 @@ public interface AllExceptColumnsSelectionDsl {
* {@include [Indent]}{@include [ColumnGroupName]}**` { `**{@include [DslGrammarTemplate.ColumnsSelectorRef]}**` \} `**
*
* {@include [Indent]}`| `{@include [ColumnGroupName]}**`(`**{@include [DslGrammarTemplate.ColumnNoAccessorRef]}**`,`**` ..`**`)`**
*
* {@include [Indent]}`| `{@include [ColumnGroupExperimentalName]}**` { `**{@include [DslGrammarTemplate.ColumnsSelectorRef]}**` \} EXPERIMENTAL!`**
*
* {@include [Indent]}`| `{@include [ColumnGroupExperimentalName]}**`(`**{@include [DslGrammarTemplate.ColumnNoAccessorRef]}**`,`**` ..`**`) EXPERIMENTAL!`**
* }
*/
public interface Grammar {
@@ -86,9 +78,6 @@ public interface AllExceptColumnsSelectionDsl {

/** __`.`__[**`allColsExcept`**][ColumnsSelectionDsl.allColsExcept] */
public interface ColumnGroupName

/** [**`exceptNew`**][ColumnsSelectionDsl.exceptNew] */
public interface ColumnGroupExperimentalName
}

/**
@@ -663,353 +652,6 @@ public interface AllExceptColumnsSelectionDsl {
columnGroup(this).allColsExceptInternal(others.toColumnSet())

// endregion

// region experiments

/**
* ## EXPERIMENTAL: Except on Column Group
*
* Selects the current column group itself, except for the specified columns. This is different from
* [allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself.
*
* As usual, all overloads for each {@include [AccessApiLink]} are available.
*
* These produce the same result:
*
* `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]`(colGroup) `[except][ColumnSet.except]` colGroup.col }`
*
* `df.`[select][DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }`
*
* These functions are experimental and may be removed or changed in the future.
*
* Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][ExperimentalExceptCsDsl]`::class)` first.
*
* ## NOTE:
* `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions
* are deleted.
*/
private interface ExperimentalExceptDocs

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> SingleColumn<DataRow<C>>.exceptNew(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(selector.toColumns())

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { other }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun <C> SingleColumn<DataRow<C>>.exceptNew(other: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
exceptNew { other }

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun <C> SingleColumn<DataRow<C>>.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
exceptNew { others.toColumnSet() }

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> SingleColumn<DataRow<C>>.exceptNew(other: String): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun <C> SingleColumn<DataRow<C>>.exceptNew(vararg others: String): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> SingleColumn<DataRow<C>>.exceptNew(other: KProperty<C>): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(column(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun <C> SingleColumn<DataRow<C>>.exceptNew(vararg others: KProperty<*>): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> SingleColumn<DataRow<C>>.exceptNew(other: ColumnPath): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun <C> SingleColumn<DataRow<C>>.exceptNew(vararg others: ColumnPath): SingleColumn<DataRow<C>> =
exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun String.exceptNew(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptNew(selector)

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { other }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun String.exceptNew(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
exceptNew { other }

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun String.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
exceptNew { others.toColumnSet() }

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun String.exceptNew(other: String): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun String.exceptNew(vararg others: String): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun String.exceptNew(other: KProperty<*>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(column(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun String.exceptNew(vararg others: KProperty<*>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun String.exceptNew(other: ColumnPath): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun String.exceptNew(vararg others: ColumnPath): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> KProperty<C>.exceptNew(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(selector.toColumns())

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { other }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun KProperty<*>.exceptNew(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
exceptNew { other }

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun KProperty<*>.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
exceptNew { others.toColumnSet() }

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> KProperty<C>.exceptNew(other: String): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun <C> KProperty<C>.exceptNew(vararg others: String): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
public infix fun <C> KProperty<DataRow<C>>.exceptNew(other: String): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
public fun <C> KProperty<DataRow<C>>.exceptNew(vararg others: String): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> KProperty<C>.exceptNew(other: KProperty<*>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(column(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun <C> KProperty<C>.exceptNew(vararg others: KProperty<*>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
public infix fun <C> KProperty<DataRow<C>>.exceptNew(other: KProperty<*>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(column(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
public fun <C> KProperty<DataRow<C>>.exceptNew(vararg others: KProperty<*>): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun <C> KProperty<C>.exceptNew(other: ColumnPath): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun <C> KProperty<C>.exceptNew(vararg others: ColumnPath): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
public infix fun <C> KProperty<DataRow<C>>.exceptNew(other: ColumnPath): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
@Suppress("INAPPLICABLE_JVM_NAME")
@JvmName("KPropertyDataRowExceptNew")
public fun <C> KProperty<DataRow<C>>.exceptNew(vararg others: ColumnPath): SingleColumn<DataRow<C>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun ColumnPath.exceptNew(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(selector.toColumns<Any?, Any?>())

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { other }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public infix fun ColumnPath.exceptNew(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
exceptNew { other }

@ExperimentalExceptCsDsl
@Deprecated(
message = ALL_COLS_EXCEPT,
replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"),
level = DeprecationLevel.ERROR,
) // present solely to redirect users to the right function
public fun ColumnPath.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
exceptNew { others.toColumnSet() }

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun ColumnPath.exceptNew(other: String): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun ColumnPath.exceptNew(vararg others: String): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun ColumnPath.exceptNew(other: KProperty<*>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(column(other))

@ExperimentalExceptCsDsl
public fun ColumnPath.exceptNew(vararg others: KProperty<*>): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public infix fun ColumnPath.exceptNew(other: ColumnPath): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(column<Any?>(other))

/**
* @include [ExperimentalExceptDocs]
*/
@ExperimentalExceptCsDsl
public fun ColumnPath.exceptNew(vararg others: ColumnPath): SingleColumn<DataRow<*>> =
columnGroup(this).exceptExperimentalInternal(others.toColumnSet())

// endregion
}

/**
@@ -1037,33 +679,4 @@ internal fun <C> ColumnSet<C>.exceptInternal(other: ColumnsResolver<*>): ColumnS
internal fun SingleColumn<DataRow<*>>.allColsExceptInternal(other: ColumnsResolver<*>): ColumnSet<Any?> =
selectInternal { all().exceptInternal(other) }

/**
* Returns a new SingleColumn<DataRow<C>> that has the same structure as the receiver, but excludes columns
* specified in the "other" ColumnsResolver.
*
* @param other The [ColumnsResolver] to use for excluding columns.
* @return A new [SingleColumn] with the filtered columns excluded.
*/
@Suppress("UNCHECKED_CAST")
internal fun <C> SingleColumn<DataRow<C>>.exceptExperimentalInternal(
other: ColumnsResolver<*>,
): SingleColumn<DataRow<C>> =
ensureIsColumnGroup().transformSingle { singleCol ->
val columnsToExcept = singleCol
.asColumnGroup()
.getColumnsWithPaths { other }
.map { it.changePath(singleCol.path + it.path) }

val newCols = listOf(singleCol).allColumnsExceptKeepingStructure(columnsToExcept)

newCols as List<ColumnWithPath<DataRow<*>>>
}.singleInternal() as SingleColumn<DataRow<C>>

/**
* Functions annotated with this annotation are experimental and will be removed or renamed in the future.
*/
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@Target(AnnotationTarget.FUNCTION)
public annotation class ExperimentalExceptCsDsl

// endregion
100 changes: 0 additions & 100 deletions core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt
Original file line number Diff line number Diff line change
@@ -282,104 +282,4 @@ class AllExceptTests : ColumnsSelectionDslTests() {
},
).shouldAllBeEqual()
}

@OptIn(ExperimentalExceptCsDsl::class)
@Test
fun `except experiments`() {
val firstNameAccessor = column<String>("firstName")
listOf(
df.select { name }.remove { name.firstName }.alsoDebug(),
df.select { cols(name) except name.firstName },
df.select { name exceptNew { cols { "first" in it.name } } },
df.select { name.exceptNew { cols { "first" in it.name } and cols { "first" in it.name } } },
df.select { name exceptNew { firstName } },
df.select { name.exceptNew { firstNameAccessor } },
df.select { name exceptNew { firstName and firstName } },
df.select { name.exceptNew { firstNameAccessor and firstNameAccessor } },
// df.select { name exceptNew name.firstName }, // not allowed
// df.select { name.exceptNew(name.firstName and name.firstName) }, // not allowed
// df.select { name exceptNew firstNameAccessor }, // not allowed
// df.select { name.exceptNew(firstNameAccessor and firstNameAccessor) }, // not allowed
df.select { name exceptNew "firstName" },
df.select { name.exceptNew("firstName") },
df.select { name.exceptNew("firstName", "firstName") },
df.select { name exceptNew Name::firstName },
df.select { name.exceptNew(Name::firstName) },
df.select { name.exceptNew(Name::firstName, Name::firstName) },
df.select { name exceptNew pathOf("firstName") },
df.select { name.exceptNew(pathOf("firstName")) },
df.select { name.exceptNew(pathOf("firstName"), pathOf("firstName")) },
df.select { "name" exceptNew { cols { "first" in it.name } } },
df.select { "name".exceptNew { cols { "first" in it.name } and cols { "first" in it.name } } },
df.select { "name".exceptNew { firstNameAccessor } },
df.select { "name".exceptNew { firstNameAccessor and firstNameAccessor } },
// df.select { "name" exceptNew name.firstName }, // not allowed
// df.select { "name".exceptNew(name.firstName and name.firstName) }, // not allowed
// df.select { "name" exceptNew firstNameAccessor }, // not allowed
// df.select { "name".exceptNew(firstNameAccessor and firstNameAccessor) }, // not allowed
df.select { "name" exceptNew "firstName" },
df.select { "name".exceptNew("firstName") },
df.select { "name".exceptNew("firstName", "firstName") },
df.select { "name" exceptNew Name::firstName },
df.select { "name".exceptNew(Name::firstName) },
df.select { "name".exceptNew(Name::firstName, Name::firstName) },
df.select { "name" exceptNew pathOf("firstName") },
df.select { "name".exceptNew(pathOf("firstName")) },
df.select { "name".exceptNew(pathOf("firstName"), pathOf("firstName")) },
// df.select { Person::name exceptNew name.firstName }, // not allowed
// df.select { Person::name.exceptNew(name.firstName and name.firstName) }, // not allowed
// df.select { Person::name exceptNew firstNameAccessor }, // not allowed
// df.select { Person::name.exceptNew(firstNameAccessor and firstNameAccessor) }, // not allowed
df.select { Person::name exceptNew "firstName" },
df.select { Person::name.exceptNew("firstName") },
df.select { Person::name.exceptNew("firstName", "firstName") },
df.select { Person::name exceptNew Name::firstName },
df.select { Person::name.exceptNew(Name::firstName) },
df.select { Person::name.exceptNew(Name::firstName, Name::firstName) },
df.select { Person::name exceptNew pathOf("firstName") },
df.select { Person::name.exceptNew(pathOf("firstName")) },
df.select { Person::name.exceptNew(pathOf("firstName"), pathOf("firstName")) },
df.select { NonDataSchemaPerson::name exceptNew { cols { "first" in it.name } } },
df.select {
NonDataSchemaPerson::name.exceptNew {
cols { "first" in it.name } and
cols { "first" in it.name }
}
},
df.select { NonDataSchemaPerson::name exceptNew { firstName } },
df.select { NonDataSchemaPerson::name.exceptNew { firstNameAccessor } },
df.select { NonDataSchemaPerson::name exceptNew { firstName and firstName } },
df.select { NonDataSchemaPerson::name.exceptNew { firstNameAccessor and firstNameAccessor } },
// df.select { NonDataSchemaPerson::name exceptNew name.firstName }, // not allowed
// df.select { NonDataSchemaPerson::name.exceptNew(name.firstName and name.firstName) }, // not allowed
// df.select { NonDataSchemaPerson::name exceptNew firstNameAccessor }, // not allowed
// df.select { NonDataSchemaPerson::name.exceptNew(firstNameAccessor and firstNameAccessor) }, // not allowed
df.select { NonDataSchemaPerson::name exceptNew "firstName" },
df.select { NonDataSchemaPerson::name.exceptNew("firstName") },
df.select { NonDataSchemaPerson::name.exceptNew("firstName", "firstName") },
df.select { NonDataSchemaPerson::name exceptNew Name::firstName },
df.select { NonDataSchemaPerson::name.exceptNew(Name::firstName) },
df.select { NonDataSchemaPerson::name.exceptNew(Name::firstName, Name::firstName) },
df.select { NonDataSchemaPerson::name exceptNew pathOf("firstName") },
df.select { NonDataSchemaPerson::name.exceptNew(pathOf("firstName")) },
df.select { NonDataSchemaPerson::name.exceptNew(pathOf("firstName"), pathOf("firstName")) },
df.select { pathOf("name") exceptNew { cols { "first" in it.name } } },
df.select { pathOf("name").exceptNew { cols { "first" in it.name } and cols { "first" in it.name } } },
df.select { pathOf("name").exceptNew { firstNameAccessor } },
df.select { pathOf("name").exceptNew { firstNameAccessor and firstNameAccessor } },
// df.select { pathOf("name") exceptNew name.firstName }, // not allowed
// df.select { pathOf("name").exceptNew(name.firstName and name.firstName) }, // not allowed
// df.select { pathOf("name") exceptNew firstNameAccessor }, // not allowed
// df.select { pathOf("name").exceptNew(firstNameAccessor and firstNameAccessor) }, // not allowed
df.select { pathOf("name") exceptNew "firstName" },
df.select { pathOf("name").exceptNew("firstName") },
df.select { pathOf("name").exceptNew("firstName", "firstName") },
df.select { pathOf("name") exceptNew Name::firstName },
df.select { pathOf("name").exceptNew(Name::firstName) },
df.select { pathOf("name").exceptNew(Name::firstName, Name::firstName) },
df.select { pathOf("name") exceptNew pathOf("firstName") },
df.select { pathOf("name").exceptNew(pathOf("firstName")) },
df.select { pathOf("name").exceptNew(pathOf("firstName"), pathOf("firstName")) },
).shouldAllBeEqual()
}
}
Original file line number Diff line number Diff line change
@@ -44,5 +44,5 @@
}
</style>
</head>
<body><p><code><code>columnGroup</code></code></p><p>    <code>| </code><code><strong><code>[</code></strong></code><code><code>column</code></code><strong><code>,</code></strong><code> ..</code><code><strong><code>]</code></strong></code></p><p>    <code>| </code><code><strong><code>[</code></strong></code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code><strong><code>]</code></strong></code></p><p>    <code>| </code><code><strong><code>{</code></strong></code><code> </code><code><code>colsSelector</code></code><code> </code><code><strong><code>}</code></strong></code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>allCols</code></strong></code><strong><code>()</code></strong></p><p>    <code>| </code><strong><code>.allCols</code></strong><code>(</code><code><strong><code>Before</code></strong></code><code>|</code><code><strong><code>After</code></strong></code><code>|</code><code><strong><code>From</code></strong></code><code>|</code><code><strong><code>UpTo</code></strong></code><code>) ( </code><strong><code>(</code></strong><code><code>column</code></code><strong><code>)</code></strong><code> | </code><strong><code>{ </code></strong><code><code>colSelector</code></code><strong><code> }</code></strong><code> )</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>allColsExcept</code></strong></code><strong><code> { </code></strong><code><code>colsSelector</code></code><strong><code> } </code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>allColsExcept</code></strong></code><strong><code>(</code></strong><code><code>columnNoAccessor</code></code><strong><code>,</code></strong><code> ..</code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>and</code></strong></code><strong><code> (</code></strong><code>|</code><strong><code>{ </code></strong><code><code>columnOrSet</code></code><strong><code> }</code></strong><code>|</code><strong><code>)</code></strong></p><p>    <code>| (</code><strong><code>.</code></strong><code><strong><code>col</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>valueCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>frameCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>colGroup</code></strong></code><code>)[</code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;</code></strong><code>]</code><strong><code>(</code></strong><code><code>column</code></code><code> | </code><code><code>index</code></code><strong><code>)</code></strong></p><p>    <code>| (</code><strong><code>.</code></strong><code><strong><code>cols</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>valueCols</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>frameCols</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>colGroups</code></strong></code><code>) [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>cols</code></strong></code><code>[</code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;</code></strong><code>]</code><strong><code>(</code></strong><code><code>column</code></code><strong><code>,</code></strong><code>.. |</code><code><code>index</code></code><strong><code>,</code></strong><code>.. |</code><code><code>indexRange</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsAtAnyDepth</code></strong></code><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsInGroups</code></strong></code><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.colsName</code></strong><code>(</code><code><strong><code>Starts</code></strong></code><code>|</code><code><strong><code>Ends</code></strong></code><code>)</code><strong><code>With</code></strong><strong><code>(</code></strong><code><code>text</code></code><code>[</code><strong><code>, </code></strong><code><code>ignoreCase</code></code><code>]</code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsNameContains</code></strong></code><strong><code>(</code></strong><code><code>text</code></code><code>[</code><strong><code>, </code></strong><code><code>ignoreCase</code></code><code>] | </code><code><code>regex</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsOfKind</code></strong></code><strong><code>(</code></strong><code><code>kind</code></code><strong><code>,</code></strong><code> ..</code><strong><code>)</code></strong><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsWithoutNulls</code></strong></code><strong><code>()</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>drop</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>Cols</code></strong></code><strong><code>(</code></strong><code><code>number</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>drop</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>ColsWhile</code></strong></code><strong><code> { </code></strong><code><code>condition</code></code><strong><code> }</code></strong></p><p>    <code>| </code><code><strong><code>exceptNew</code></strong></code><strong><code> { </code></strong><code><code>colsSelector</code></code><strong><code> } EXPERIMENTAL!</code></strong></p><p>    <code>| </code><code><strong><code>exceptNew</code></strong></code><strong><code>(</code></strong><code><code>columnNoAccessor</code></code><strong><code>,</code></strong><code> ..</code><strong><code>) EXPERIMENTAL!</code></strong></p><p>    <code>| (</code><strong><code>.</code></strong><code><strong><code>firstCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>lastCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>singleCol</code></strong></code><code>) [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>select</code></strong></code><strong><code> { </code></strong><code><code>colsSelector</code></code><strong><code> }</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>take</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>Cols</code></strong></code><strong><code>(</code></strong><code><code>number</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>take</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>ColsWhile</code></strong></code><strong><code> { </code></strong><code><code>condition</code></code><strong><code> }</code></strong></p><p>    </p><p><code><code>singleColumn</code></code></p><p>    <strong><code>.</code></strong><code><strong><code>colsOf</code></strong></code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;</code></strong><code> [ </code><strong><code>(</code></strong><code><code>kType</code></code><strong><code>)</code></strong><code> ] [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    </p><p><code><code>columnGroupReference</code></code></p><p>    <strong><code>.</code></strong><code><strong><code>colsOf</code></strong></code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;(</code></strong><code><code>kType</code></code><strong><code>)</code></strong><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p></body>
<body><p><code><code>columnGroup</code></code></p><p>    <code>| </code><code><strong><code>[</code></strong></code><code><code>column</code></code><strong><code>,</code></strong><code> ..</code><code><strong><code>]</code></strong></code></p><p>    <code>| </code><code><strong><code>[</code></strong></code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code><strong><code>]</code></strong></code></p><p>    <code>| </code><code><strong><code>{</code></strong></code><code> </code><code><code>colsSelector</code></code><code> </code><code><strong><code>}</code></strong></code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>allCols</code></strong></code><strong><code>()</code></strong></p><p>    <code>| </code><strong><code>.allCols</code></strong><code>(</code><code><strong><code>Before</code></strong></code><code>|</code><code><strong><code>After</code></strong></code><code>|</code><code><strong><code>From</code></strong></code><code>|</code><code><strong><code>UpTo</code></strong></code><code>) ( </code><strong><code>(</code></strong><code><code>column</code></code><strong><code>)</code></strong><code> | </code><strong><code>{ </code></strong><code><code>colSelector</code></code><strong><code> }</code></strong><code> )</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>allColsExcept</code></strong></code><strong><code> { </code></strong><code><code>colsSelector</code></code><strong><code> } </code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>allColsExcept</code></strong></code><strong><code>(</code></strong><code><code>columnNoAccessor</code></code><strong><code>,</code></strong><code> ..</code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>and</code></strong></code><strong><code> (</code></strong><code>|</code><strong><code>{ </code></strong><code><code>columnOrSet</code></code><strong><code> }</code></strong><code>|</code><strong><code>)</code></strong></p><p>    <code>| (</code><strong><code>.</code></strong><code><strong><code>col</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>valueCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>frameCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>colGroup</code></strong></code><code>)[</code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;</code></strong><code>]</code><strong><code>(</code></strong><code><code>column</code></code><code> | </code><code><code>index</code></code><strong><code>)</code></strong></p><p>    <code>| (</code><strong><code>.</code></strong><code><strong><code>cols</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>valueCols</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>frameCols</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>colGroups</code></strong></code><code>) [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>cols</code></strong></code><code>[</code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;</code></strong><code>]</code><strong><code>(</code></strong><code><code>column</code></code><strong><code>,</code></strong><code>.. |</code><code><code>index</code></code><strong><code>,</code></strong><code>.. |</code><code><code>indexRange</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsAtAnyDepth</code></strong></code><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsInGroups</code></strong></code><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.colsName</code></strong><code>(</code><code><strong><code>Starts</code></strong></code><code>|</code><code><strong><code>Ends</code></strong></code><code>)</code><strong><code>With</code></strong><strong><code>(</code></strong><code><code>text</code></code><code>[</code><strong><code>, </code></strong><code><code>ignoreCase</code></code><code>]</code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsNameContains</code></strong></code><strong><code>(</code></strong><code><code>text</code></code><code>[</code><strong><code>, </code></strong><code><code>ignoreCase</code></code><code>] | </code><code><code>regex</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsOfKind</code></strong></code><strong><code>(</code></strong><code><code>kind</code></code><strong><code>,</code></strong><code> ..</code><strong><code>)</code></strong><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>colsWithoutNulls</code></strong></code><strong><code>()</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>drop</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>Cols</code></strong></code><strong><code>(</code></strong><code><code>number</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>drop</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>ColsWhile</code></strong></code><strong><code> { </code></strong><code><code>condition</code></code><strong><code> }</code></strong></p><p>    <code>| (</code><strong><code>.</code></strong><code><strong><code>firstCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>lastCol</code></strong></code><code>| </code><strong><code>.</code></strong><code><strong><code>singleCol</code></strong></code><code>) [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>select</code></strong></code><strong><code> { </code></strong><code><code>colsSelector</code></code><strong><code> }</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>take</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>Cols</code></strong></code><strong><code>(</code></strong><code><code>number</code></code><strong><code>)</code></strong></p><p>    <code>| </code><strong><code>.</code></strong><code><strong><code>take</code></strong></code><code>(</code><code><strong><code>Last</code></strong></code><code>)</code><code><strong><code>ColsWhile</code></strong></code><strong><code> { </code></strong><code><code>condition</code></code><strong><code> }</code></strong></p><p>    </p><p><code><code>singleColumn</code></code></p><p>    <strong><code>.</code></strong><code><strong><code>colsOf</code></strong></code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;</code></strong><code> [ </code><strong><code>(</code></strong><code><code>kType</code></code><strong><code>)</code></strong><code> ] [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p><p>    </p><p><code><code>columnGroupReference</code></code></p><p>    <strong><code>.</code></strong><code><strong><code>colsOf</code></strong></code><strong><code>&lt;</code></strong><code><code>T</code></code><strong><code>&gt;(</code></strong><code><code>kType</code></code><strong><code>)</code></strong><code> [ </code><strong><code>{ </code></strong><code><code>condition</code></code><strong><code> }</code></strong><code> ]</code></p></body>
<html/>
20 changes: 1 addition & 19 deletions docs/StardustDocs/topics/ColumnSelectors.md
Original file line number Diff line number Diff line change
@@ -299,26 +299,8 @@ or
Note the name change, similar to [`allCols`](ColumnSelectors.md#cols), this makes it clearer that you're selecting
columns inside the group, 'lifting' them out.

**Experimental: Except on Column Group**

Selects the current [column group](DataColumn.md#columngroup) itself, except for the specified columns.
This is different from `allColsExcept` in that it does not 'lift' the columns out of the group,
but instead selects the group itself.

These all produce the same result:

`df.select { colGroup exceptNew { col } }`

`df.select { colGroup }.remove { colGroup.col }`

`df.select { cols(colGroup) except colGroup.col }`

> NOTE: This function is experimental and will definitely change in the future.
> It's named `exceptNew` until the deprecated `SingleColumn.except()` overloads are removed.
> Most likely, it'll be renamed to `except` afterward.
> Until then, it requires `@OptIn(ExperimentalExceptCsDsl::class)` to be used.
##### Column Name Filters {collapsible="true"}

`nameContains()`, `colsNameContains()`, `nameStartsWith()`, `colsNameEndsWith()`

Creates a `ColumnSet` containing columns from the top-level, specified [column group](DataColumn.md#columngroup),