Skip to content

Commit a8dad48

Browse files
authored
Merge pull request #708 from Kotlin/k2
K2 preparation
2 parents 75d8e78 + 5d4793a commit a8dad48

File tree

43 files changed

+261
-1001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+261
-1001
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Default ignored files
22
.idea
33
.gradle
4+
.kotlin
45
build
56
.ipynb_checkpoints

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/ColumnsForAggregateSelectionDsl.kt

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ public interface ColumnsForAggregateSelectionDsl<out T> : ColumnsSelectionDsl<T>
1313
ConfiguredAggregateColumn.withDefault(this, defaultValue)
1414

1515
public infix fun <C> SingleColumn<C>.default(defaultValue: C): SingleColumn<C> =
16-
ConfiguredAggregateColumn.withDefault(this, defaultValue).single()
16+
ConfiguredAggregateColumn.withDefault(this, defaultValue)
1717

1818
public fun path(vararg names: String): ColumnPath = ColumnPath(names.asList())
1919

20-
public infix fun <C> ColumnSet<C>.into(name: String): ColumnSet<C> = ConfiguredAggregateColumn.withPath(this, pathOf(name))
20+
public infix fun <C> ColumnSet<C>.into(name: String): ColumnSet<C> =
21+
ConfiguredAggregateColumn.withPath(this, pathOf(name))
2122

2223
public infix fun <C> SingleColumn<C>.into(name: String): SingleColumn<C> =
23-
ConfiguredAggregateColumn.withPath(this, pathOf(name)).single()
24+
ConfiguredAggregateColumn.withPath(this, pathOf(name))
2425

25-
public infix fun <C> ColumnSet<C>.into(path: ColumnPath): ColumnSet<C> = ConfiguredAggregateColumn.withPath(this, path)
26+
public infix fun <C> ColumnSet<C>.into(path: ColumnPath): ColumnSet<C> =
27+
ConfiguredAggregateColumn.withPath(this, path)
2628

2729
public infix fun <C> SingleColumn<C>.into(path: ColumnPath): SingleColumn<C> =
28-
ConfiguredAggregateColumn.withPath(this, path).single()
30+
ConfiguredAggregateColumn.withPath(this, path)
2931
}

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

+6-60
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
8282
SingleColumnsSelectionDsl,
8383

8484
// col(name), col(5), [5]
85-
ColColumnsSelectionDsl,
85+
ColColumnsSelectionDsl<T>,
8686
// valueCol(name), valueCol(5)
87-
ValueColColumnsSelectionDsl,
87+
ValueColColumnsSelectionDsl<T>,
8888
// frameCol(name), frameCol(5)
89-
FrameColColumnsSelectionDsl,
89+
FrameColColumnsSelectionDsl<T>,
9090
// colGroup(name), colGroup(5)
91-
ColGroupColumnsSelectionDsl,
91+
ColGroupColumnsSelectionDsl<T>,
9292

9393
// cols {}, cols(), cols(colA, colB), cols(1, 5), cols(1..5), [{}]
94-
ColsColumnsSelectionDsl,
94+
ColsColumnsSelectionDsl<T>,
9595

9696
// colA.."colB"
9797
ColumnRangeColumnsSelectionDsl,
@@ -106,7 +106,7 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
106106
ColsOfKindColumnsSelectionDsl,
107107

108108
// all(Cols), allAfter(colA), allBefore(colA), allFrom(colA), allUpTo(colA)
109-
AllColumnsSelectionDsl,
109+
AllColumnsSelectionDsl<T>,
110110
// colsAtAnyDepth {}, colsAtAnyDepth()
111111
ColsAtAnyDepthColumnsSelectionDsl,
112112
// colsInGroups {}, colsInGroups()
@@ -494,58 +494,6 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
494494
public operator fun <C, R> SingleColumn<DataRow<C>>.invoke(selector: ColumnsSelector<C, R>): ColumnSet<R> =
495495
select(selector)
496496

497-
/**
498-
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
499-
*
500-
* Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on
501-
* any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all
502-
* operations of the DSL are at your disposal.
503-
*
504-
* The scope of the new DSL instance is relative to
505-
* the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from.
506-
*
507-
* The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method.
508-
*
509-
* ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar]
510-
*
511-
* #### For example:
512-
*
513-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }`
514-
*
515-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }`
516-
*
517-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }`
518-
*
519-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }`
520-
*
521-
* #### Examples for this overload:
522-
*
523-
* `df.`[select][DataFrame.select]` { Type::myColGroup.`[`select`][KProperty.select]` { someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() } }`
524-
*
525-
* `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup `[`{`][KProperty.select]` colA `[`and`][ColumnsSelectionDsl.and]` colB `[`}`][KProperty.select]` }`
526-
*
527-
* ## NOTE:
528-
* If you get a warning `CANDIDATE_CHOSEN_USING_OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION`, you
529-
* can safely ignore this. It is caused by a workaround for a bug in the Kotlin compiler
530-
* ([KT-64092](https://youtrack.jetbrains.com/issue/KT-64092/OVERLOADRESOLUTIONAMBIGUITY-caused-by-lambda-argument)).
531-
*
532-
*
533-
* &nbsp;&nbsp;&nbsp;&nbsp;
534-
*
535-
*
536-
* See also [except][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function.
537-
*
538-
* @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection.
539-
* @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from.
540-
* @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup].
541-
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector].
542-
* @see [SingleColumn.except]
543-
*/
544-
@Suppress("INAPPLICABLE_JVM_NAME")
545-
@JvmName("KPropertyDataRowInvoke")
546-
public operator fun <C, R> KProperty<DataRow<C>>.invoke(selector: ColumnsSelector<C, R>): ColumnSet<R> =
547-
select(selector)
548-
549497
/**
550498
* ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]
551499
*
@@ -588,8 +536,6 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
588536
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector].
589537
* @see [SingleColumn.except]
590538
*/
591-
@OptIn(ExperimentalTypeInference::class)
592-
@OverloadResolutionByLambdaReturnType
593539
public operator fun <C, R> KProperty<C>.invoke(selector: ColumnsSelector<C, R>): ColumnSet<R> =
594540
columnGroup(this).select(selector)
595541

0 commit comments

Comments
 (0)