Skip to content

Commit 6f33e75

Browse files
Automated commit of generated code
1 parent 8235e3f commit 6f33e75

File tree

2 files changed

+8
-5
lines changed
  • core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe

2 files changed

+8
-5
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ public fun GroupBy<*, *>.schema(): DataFrameSchema = toDataFrame().schema()
2626

2727
// endregion
2828

29-
public inline fun <reified T> DataFrame<T>.compileTimeSchema(): DataFrameSchema =
30-
compileTimeSchemaImpl(schema(), T::class)
29+
/**
30+
* [ordered] - if true, columns are ordered the same as in runtime schema for easier diff between the two.
31+
* if false, columns are ordered as they are represented in the compiler plugin
32+
*/
33+
public inline fun <reified T> DataFrame<T>.compileTimeSchema(ordered: Boolean = true): DataFrameSchema =
34+
compileTimeSchemaImpl(if (ordered) schema() else null, T::class)

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema
88
import kotlin.reflect.KClass
99

1010
@PublishedApi
11-
internal fun compileTimeSchemaImpl(runtimeSchema: DataFrameSchema, klass: KClass<*>): DataFrameSchema {
11+
internal fun compileTimeSchemaImpl(runtimeSchema: DataFrameSchema?, klass: KClass<*>): DataFrameSchema {
1212
val compileSchema = getSchema(klass)
13+
if (runtimeSchema == null) return compileSchema
1314
val root = ColumnPath(emptyList())
1415
val order = buildMap {
1516
putColumnsOrder(runtimeSchema, path = root)
@@ -41,8 +42,6 @@ internal fun DataFrameSchema.sortedBy(order: Map<ColumnPath, Int>, path: ColumnP
4142
is ColumnSchema.Group -> ColumnSchema.Group(column.schema.sortedBy(order, path + name), column.contentType)
4243

4344
is ColumnSchema.Value -> column
44-
45-
else -> TODO("unexpected ColumnSchema class ${column::class}")
4645
}
4746
}.sortedBy { (name, _) ->
4847
order[path + name]

0 commit comments

Comments
 (0)