Skip to content

Commit 21bbbed

Browse files
committed
simplifying and, continuing kdocs except, adding experimental exceptNew with all its overloads and tests
1 parent 796f74d commit 21bbbed

File tree

15 files changed

+1335
-421
lines changed

15 files changed

+1335
-421
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public interface ColumnsSelectionDsl<out T> : /* SingleColumn<DataRow<T>> */
128128
// filter {}
129129
FilterColumnsSelectionDsl,
130130
// colSet and colB
131-
AndColumnsSelectionDsl<T>,
131+
AndColumnsSelectionDsl,
132132
// colA named "colB", colA into "colB"
133133
RenameColumnsSelectionDsl,
134134
// expr {}

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

Lines changed: 637 additions & 78 deletions
Large diffs are not rendered by default.

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

Lines changed: 1 addition & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import kotlin.reflect.KProperty
2121
/**
2222
* See [Usage]
2323
*/
24-
public interface AndColumnsSelectionDsl<out T> {
24+
public interface AndColumnsSelectionDsl {
2525

2626
/**
2727
* ## And Operator Usage
@@ -646,191 +646,6 @@ public interface AndColumnsSelectionDsl<out T> {
646646
toColumnAccessor() and other.toColumnAccessor()
647647

648648
// endregion
649-
650-
// region ColumnsSelector
651-
652-
/**
653-
* ## And Operator
654-
* The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once.
655-
*
656-
* You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]!
657-
*
658-
* Check out the [Usage][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Usage] for how to use [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and].
659-
*
660-
* ### Examples:
661-
*
662-
* `df.`[groupBy][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[and][kotlin.String.and]` colB }`
663-
*
664-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {`
665-
*
666-
* &nbsp;&nbsp;&nbsp;&nbsp;[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {`
667-
*
668-
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`
669-
*
670-
* &nbsp;&nbsp;&nbsp;&nbsp;`}`
671-
*
672-
* `}`
673-
*
674-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[and][kotlin.String.and]` Type::colB `[and][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }`
675-
*
676-
* #### Example for this overload:
677-
*
678-
* `val intCols: `[ColumnsSelector][ColumnsSelector]`<*, `[Int][Int]`> = { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>() }`
679-
*
680-
* `df.`[select][DataFrame.select]` { intCols `[and][and] {@getArg [ColumnsSelectorAndDocs.Argument]}` }`
681-
*
682-
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left
683-
* and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator.
684-
*/
685-
private interface ColumnsSelectorAndDocs {
686-
687-
interface Argument
688-
}
689-
690-
/** ## And Operator
691-
* The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once.
692-
*
693-
* You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]!
694-
*
695-
* Check out the [Usage][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Usage] for how to use [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and].
696-
*
697-
* ### Examples:
698-
*
699-
* `df.`[groupBy][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[and][kotlin.String.and]` colB }`
700-
*
701-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {`
702-
*
703-
* &nbsp;&nbsp;&nbsp;&nbsp;[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {`
704-
*
705-
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`
706-
*
707-
* &nbsp;&nbsp;&nbsp;&nbsp;`}`
708-
*
709-
* `}`
710-
*
711-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[and][kotlin.String.and]` Type::colB `[and][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }`
712-
*
713-
* #### Example for this overload:
714-
*
715-
* `val intCols: `[ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector]`<*, `[Int][Int]`> = { `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }`
716-
*
717-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { intCols `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] [colsOf][SingleColumn.colsOf]`<`[Int][Int]`>()` }`
718-
*
719-
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left
720-
* and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator.
721-
*/
722-
public infix fun <C> ColumnsSelector<T, C>.and(other: ColumnsResolver<C>): ColumnSet<C> = this() and other
723-
724-
/** ## And Operator
725-
* The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once.
726-
*
727-
* You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]!
728-
*
729-
* Check out the [Usage][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Usage] for how to use [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and].
730-
*
731-
* ### Examples:
732-
*
733-
* `df.`[groupBy][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[and][kotlin.String.and]` colB }`
734-
*
735-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {`
736-
*
737-
* &nbsp;&nbsp;&nbsp;&nbsp;[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {`
738-
*
739-
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`
740-
*
741-
* &nbsp;&nbsp;&nbsp;&nbsp;`}`
742-
*
743-
* `}`
744-
*
745-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[and][kotlin.String.and]` Type::colB `[and][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }`
746-
*
747-
* #### Example for this overload:
748-
*
749-
* `val intCols: `[ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector]`<*, `[Int][Int]`> = { `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }`
750-
*
751-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { intCols `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] `{ colA `[/][DataColumn.div]` 2.0 `[named][ColumnReference.named]` "half colA" ` }` `}
752-
*
753-
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left
754-
* and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator.
755-
*/
756-
public infix fun <C> ColumnsSelector<T, C>.and(other: () -> ColumnsResolver<C>): ColumnSet<C> = this() and other
757-
758-
/** ## And Operator
759-
* The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once.
760-
*
761-
* You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]!
762-
*
763-
* Check out the [Usage][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Usage] for how to use [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and].
764-
*
765-
* ### Examples:
766-
*
767-
* `df.`[groupBy][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[and][kotlin.String.and]` colB }`
768-
*
769-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {`
770-
*
771-
* &nbsp;&nbsp;&nbsp;&nbsp;[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {`
772-
*
773-
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`
774-
*
775-
* &nbsp;&nbsp;&nbsp;&nbsp;`}`
776-
*
777-
* `}`
778-
*
779-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[and][kotlin.String.and]` Type::colB `[and][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }`
780-
*
781-
* #### Example for this overload:
782-
*
783-
* `val intCols: `[ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector]`<*, `[Int][Int]`> = { `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }`
784-
*
785-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { intCols `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] "colB"` }`
786-
*
787-
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left
788-
* and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator.
789-
*/
790-
public infix fun <C> ColumnsSelector<T, C>.and(other: String): ColumnSet<*> = this() and other
791-
792-
/** ## And Operator
793-
* The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once.
794-
*
795-
* You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]!
796-
*
797-
* Check out the [Usage][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Usage] for how to use [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and].
798-
*
799-
* ### Examples:
800-
*
801-
* `df.`[groupBy][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[and][kotlin.String.and]` colB }`
802-
*
803-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {`
804-
*
805-
* &nbsp;&nbsp;&nbsp;&nbsp;[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {`
806-
*
807-
* &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`
808-
*
809-
* &nbsp;&nbsp;&nbsp;&nbsp;`}`
810-
*
811-
* `}`
812-
*
813-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[and][kotlin.String.and]` Type::colB `[and][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[and][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }`
814-
*
815-
* #### Example for this overload:
816-
*
817-
* `val intCols: `[ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector]`<*, `[Int][Int]`> = { `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }`
818-
*
819-
* `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { intCols `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] Type::colB` }`
820-
*
821-
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left
822-
* and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator.
823-
*/
824-
public infix fun <C> ColumnsSelector<T, C>.and(other: KProperty<C>): ColumnSet<C> = this() and other
825-
826-
// endregion
827-
828-
/**
829-
* Invokes the given [ColumnsSelector] using this [ColumnsSelectionDsl] but only if the [T] of the
830-
* [ColumnsSelector] matches with the [ColumnsSelectionDsl]`<T>`.
831-
*/
832-
private operator fun <C> ColumnsSelector<T, C>.invoke(): ColumnsResolver<C> =
833-
this@invoke(this@AndColumnsSelectionDsl as ColumnsSelectionDsl<T>, this@AndColumnsSelectionDsl)
834649
}
835650

836651
// endregion

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ public interface SelectColumnsSelectionDsl {
359359
columnGroup(this).select(selector)
360360

361361
// region deprecated
362+
362363
@Deprecated(
363364
message = COL_SELECT_DSL_SELECT_COLS,
364365
replaceWith = ReplaceWith(COL_SELECT_DSL_SELECT_COLS_REPLACE),
@@ -382,6 +383,7 @@ public interface SelectColumnsSelectionDsl {
382383
)
383384
public fun <R> SingleColumn<DataRow<*>>.select(vararg columns: KProperty<R>): ColumnSet<R> =
384385
selectInternal { columns.toColumnSet() }
386+
385387
// endregion
386388
}
387389

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,15 @@ internal const val COL_SELECT_DSL_SELECT_COLS_REPLACE = "this.cols(*columns)"
9595

9696
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT = "This function is replaced with allColsExcept. $message_0_14"
9797
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_SELECTOR = "this.allColsExcept(selector)"
98-
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVER = "this.allColsExcept { others.toColumnSet() }"
98+
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVERS = "this.allColsExcept { others.toColumnSet() }"
99+
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_RESOLVER = "this.allColsExcept { other }"
99100
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHERS = "this.allColsExcept(*others)"
101+
internal const val COL_SELECT_DSL_SINGLE_COL_EXCEPT_REPLACE_OTHER = "this.allColsExcept(other)"
100102

101103
internal const val COL_SELECT_DSL_EXCEPT = "This function is replaced with allExcept. $message_0_14"
102104
internal const val COL_SELECT_DSL_EXCEPT_REPLACE_SELECTOR = "this.allExcept(selector)"
103105
internal const val COL_SELECT_DSL_EXCEPT_REPLACE_RESOLVER = "this.allExcept(*others)"
104106

105-
106107
// endregion
107108

108109
// region WARNING in 0.14, ERROR in 0.15

0 commit comments

Comments
 (0)