Skip to content

Commit

Permalink
fixup! updating generated-sources
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Jul 1, 2024
1 parent a0c1a18 commit 1e856c0
Show file tree
Hide file tree
Showing 118 changed files with 1,316 additions and 1,900 deletions.
7 changes: 7 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ val processKDocsMain by creatingProcessDocTask(processKDocsMainSources) {
}
}

tasks.named("ktlintGeneratedSourcesSourceSetCheck") {
onlyIf { false }
}
tasks.named("runKtlintCheckOverGeneratedSourcesSourceSet") {
onlyIf { false }
}

// Exclude the generated/processed sources from the IDE
idea {
module {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,8 @@ internal interface DiffOrNullDocs
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
public fun <T> DataRow<T>.diff(firstRowResult: Double, expression: RowExpression<T, Double>): Double =
prev()?.let { p ->
expression(
this,
this,
) - expression(p, p)
} ?: firstRowResult
prev()?.let { p -> expression(this, this) - expression(p, p) }
?: firstRowResult

/**
* Calculates the difference between the results of a row expression computed on the current and previous DataRow.
Expand All @@ -120,28 +116,26 @@ public fun <T> DataRow<T>.diff(firstRowResult: Double, expression: RowExpression
@OverloadResolutionByLambdaReturnType
// required to resolve `diff(0) { intValue }`
public fun <T> DataRow<T>.diff(firstRowResult: Int, expression: RowExpression<T, Int>): Int =
prev()?.let { p ->
expression(
this,
this,
) - expression(p, p)
} ?: firstRowResult
prev()?.let { p -> expression(this, this) - expression(p, p) }
?: firstRowResult

/**
* Calculates the difference between the results of a row expression computed on the current and previous DataRow.
*
* @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows
*/
public fun <T> DataRow<T>.diff(firstRowResult: Long, expression: RowExpression<T, Long>): Long =
prev()?.let { p -> expression(this, this) - expression(p, p) } ?: firstRowResult
prev()?.let { p -> expression(this, this) - expression(p, p) }
?: firstRowResult

/**
* Calculates the difference between the results of a row expression computed on the current and previous DataRow.
*
* @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows
*/
public fun <T> DataRow<T>.diff(firstRowResult: Float, expression: RowExpression<T, Float>): Float =
prev()?.let { p -> expression(this, this) - expression(p, p) } ?: firstRowResult
prev()?.let { p -> expression(this, this) - expression(p, p) }
?: firstRowResult

/**
* Calculates the difference between the results of a row expression computed on the current and previous DataRow.
Expand All @@ -151,12 +145,7 @@ public fun <T> DataRow<T>.diff(firstRowResult: Float, expression: RowExpression<
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
public fun <T> DataRow<T>.diffOrNull(expression: RowExpression<T, Double>): Double? =
prev()?.let { p ->
expression(
this,
this,
) - expression(p, p)
}
prev()?.let { p -> expression(this, this) - expression(p, p) }

/**
* Calculates the difference between the results of a row expression computed on the current and previous DataRow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ public value class JsonPath(
JsonPath(
path.toCharArray().let { chars ->
val lastStarIndex = chars.lastIndexOf('*')
chars
.flatMapIndexed { i, c ->
if (i == lastStarIndex) {
index.toString().toCharArray().toList()
} else {
listOf(c)
}
}.joinToString("")
chars.flatMapIndexed { i, c ->
if (i == lastStarIndex) {
index.toString().toCharArray().toList()
} else {
listOf(c)
}
}.joinToString("")
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@ public fun <T, R> Pivot<T>.aggregate(separate: Boolean = false, body: Selector<A
@Refine
@Interpretable("Aggregate")
public fun <T, R> Grouped<T>.aggregate(body: AggregateGroupedBody<T, R>): DataFrame<T> =
aggregateGroupBy((this as GroupBy<*, *>).toDataFrame(), {
groups.cast()
}, removeColumns = true, body).cast<T>()
aggregateGroupBy((this as GroupBy<*, *>).toDataFrame(), { groups.cast() }, removeColumns = true, body).cast<T>()
Original file line number Diff line number Diff line change
Expand Up @@ -4663,17 +4663,16 @@ internal fun SingleColumn<DataRow<*>>.allColsExceptInternal(other: ColumnsResolv
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) }
ensureIsColumnGroup().transformSingle { singleCol ->
val columnsToExcept = singleCol
.asColumnGroup()
.getColumnsWithPaths { other }
.map { it.changePath(singleCol.path + it.path) }

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

newCols as List<ColumnWithPath<DataRow<*>>>
}.singleInternal() as SingleColumn<DataRow<C>>
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,19 @@ public fun <T> DataFrame<T>.append(vararg values: Any?): DataFrame<T> {
"Invalid number of arguments. Multiple of $ncol is expected, but actual was: ${values.size}"
}
val newRows = values.size / ncol
return columns()
.mapIndexed { colIndex, col ->
val newValues = (0 until newRows).map { values[colIndex + it * ncol] }
col.updateWith(col.values + newValues)
}.toDataFrame()
.cast()
return columns().mapIndexed { colIndex, col ->
val newValues = (0 until newRows).map { values[colIndex + it * ncol] }
col.updateWith(col.values + newValues)
}.toDataFrame().cast()
}

public fun <T> DataFrame<T>.appendNulls(numberOfRows: Int = 1): DataFrame<T> {
require(numberOfRows >= 0)
if (numberOfRows == 0) return this
if (ncol == 0) return DataFrame.empty(nrow + numberOfRows).cast()
return columns()
.map { col ->
col.updateWith(col.values + arrayOfNulls(numberOfRows))
}.toDataFrame()
.cast()
return columns().map { col ->
col.updateWith(col.values + arrayOfNulls(numberOfRows))
}.toDataFrame().cast()
}

// endregion
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,11 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column.
*/
public fun <C> SingleColumn<DataRow<*>>.col(col: ColumnAccessor<C>): SingleColumn<C> =
this
.ensureIsColumnGroup()
.transformSingle {
val child = it.getCol(col)
?: throw IllegalStateException("Column '${col.path()}' not found in column group '${it.path}'")
listOf(child)
}.singleImpl()
this.ensureIsColumnGroup().transformSingle {
val child = it.getCol(col)
?: throw IllegalStateException("Column '${col.path()}' not found in column group '${it.path}'")
listOf(child)
}.singleImpl()

/**
* ## Col
Expand Down Expand Up @@ -814,13 +812,11 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column.
*/
public fun <C> SingleColumn<DataRow<*>>.col(name: String): SingleColumn<C> =
this
.ensureIsColumnGroup()
.transformSingle {
val child = it.getCol(name)?.cast<C>()
?: throw IllegalStateException("Column '$name' not found in column group '${it.path}'")
listOf(child)
}.singleImpl()
this.ensureIsColumnGroup().transformSingle {
val child = it.getCol(name)?.cast<C>()
?: throw IllegalStateException("Column '$name' not found in column group '${it.path}'")
listOf(child)
}.singleImpl()

/**
* ## Col
Expand Down Expand Up @@ -1511,13 +1507,11 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column.
*/
public fun <C> SingleColumn<DataRow<*>>.col(path: ColumnPath): SingleColumn<C> =
this
.ensureIsColumnGroup()
.transformSingle {
val child = it.getCol(path)?.cast<C>()
?: throw IllegalStateException("Column '$path' not found in column group '${it.path}'")
listOf(child)
}.singleImpl()
this.ensureIsColumnGroup().transformSingle {
val child = it.getCol(path)?.cast<C>()
?: throw IllegalStateException("Column '$path' not found in column group '${it.path}'")
listOf(child)
}.singleImpl()

/**
* ## Col
Expand Down Expand Up @@ -2679,8 +2673,7 @@ public interface ColColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column.
*/
public fun <C> SingleColumn<DataRow<*>>.col(index: Int): SingleColumn<C> =
this
.ensureIsColumnGroup()
this.ensureIsColumnGroup()
.allColumnsInternal()
.getAt(index)
.cast()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,14 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column group.
*/
public fun <C> SingleColumn<DataRow<*>>.colGroup(colGroup: ColumnAccessor<DataRow<C>>): SingleColumn<DataRow<C>> =
this
.ensureIsColumnGroup()
.transformSingle {
val child = it.getCol(colGroup)
?: throw IllegalStateException(
"ColumnGroup '${colGroup.path()}' not found in column group '${it.path}'",
)
child.data.ensureIsColumnGroup()
listOf(child)
}.singleImpl()
this.ensureIsColumnGroup().transformSingle {
val child = it.getCol(colGroup)
?: throw IllegalStateException(
"ColumnGroup '${colGroup.path()}' not found in column group '${it.path}'",
)
child.data.ensureIsColumnGroup()
listOf(child)
}.singleImpl()

/**
* ## Col Group
Expand Down Expand Up @@ -842,14 +840,12 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column group.
*/
public fun <C> SingleColumn<DataRow<*>>.colGroup(name: String): SingleColumn<DataRow<C>> =
this
.ensureIsColumnGroup()
.transformSingle {
val child = it.getCol(name)?.cast<DataRow<C>>()
?: throw IllegalStateException("Column group '$name' not found in column group '${it.path}'")
child.data.ensureIsColumnGroup()
listOf(child)
}.singleImpl()
this.ensureIsColumnGroup().transformSingle {
val child = it.getCol(name)?.cast<DataRow<C>>()
?: throw IllegalStateException("Column group '$name' not found in column group '${it.path}'")
child.data.ensureIsColumnGroup()
listOf(child)
}.singleImpl()

/**
* ## Col Group
Expand Down Expand Up @@ -1565,8 +1561,7 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column group.
*/
public fun <C> SingleColumn<DataRow<*>>.colGroup(path: ColumnPath): SingleColumn<DataRow<C>> =
this
.ensureIsColumnGroup()
this.ensureIsColumnGroup()
.transformSingle {
val child = it.getCol(path)?.cast<DataRow<C>>()
?: throw IllegalStateException("Column group '$path' not found in column group '${it.path}'")
Expand Down Expand Up @@ -3110,8 +3105,7 @@ public interface ColGroupColumnsSelectionDsl<out _UNUSED> {
* @param [C] The type of the column group.
*/
public fun <C> SingleColumn<DataRow<*>>.colGroup(index: Int): SingleColumn<DataRow<C>> =
this
.ensureIsColumnGroup()
this.ensureIsColumnGroup()
.allColumnsInternal()
.getAt(index)
.cast<DataRow<C>>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4893,14 +4893,13 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
}

internal fun SingleColumn<DataRow<*>>.colsInternal(refs: Iterable<ColumnReference<*>>): ColumnSet<*> =
ensureIsColumnGroup()
.transformSingle { col ->
refs.map {
col.getCol(it) ?: throw IllegalArgumentException(
"Column at ${col.path.plus(it.path()).joinToString()} was not found.",
)
}
ensureIsColumnGroup().transformSingle { col ->
refs.map {
col.getCol(it) ?: throw IllegalArgumentException(
"Column at ${col.path.plus(it.path()).joinToString()} was not found.",
)
}
}

/**
* If this [ColumnsResolver] is a [SingleColumn], it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ public interface ColsOfKindColumnsSelectionDsl {
internal fun ColumnsResolver<*>.columnsOfKindInternal(
kinds: Set<ColumnKind>,
filter: ColumnFilter<*>,
): TransformableColumnSet<*> =
colsInternal {
it.kind() in kinds && filter(it)
}
): TransformableColumnSet<*> = colsInternal { it.kind() in kinds && filter(it) }

// endregion
Loading

0 comments on commit 1e856c0

Please sign in to comment.