File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/schema
plugins/kotlin-dataframe/testData Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
6
6
import org.jetbrains.kotlinx.dataframe.DataRow
7
7
import org.jetbrains.kotlinx.dataframe.columns.ColumnKind
8
8
import org.jetbrains.kotlinx.dataframe.schema.ComparisonMode.LENIENT
9
- import org.jetbrains.kotlinx.dataframe.schema.ComparisonMode.STRICT
10
9
import org.jetbrains.kotlinx.dataframe.schema.ComparisonMode.STRICT_FOR_NESTED_SCHEMAS
11
10
import kotlin.reflect.KType
12
11
import kotlin.reflect.full.isSubtypeOf
@@ -58,7 +57,7 @@ public sealed class ColumnSchema {
58
57
override val nullable: Boolean = false
59
58
override val type: KType get() = typeOf<AnyRow >()
60
59
61
- public fun compare (other : Group , comparisonMode : ComparisonMode = LENIENT ): CompareResult =
60
+ public fun compare (other : Group , comparisonMode : ComparisonMode = STRICT_FOR_NESTED_SCHEMAS ): CompareResult =
62
61
schema.compare(
63
62
other = other.schema,
64
63
comparisonMode = comparisonMode,
@@ -92,7 +91,7 @@ public sealed class ColumnSchema {
92
91
}
93
92
}
94
93
95
- public fun compare (other : ColumnSchema , comparisonMode : ComparisonMode = LENIENT ): CompareResult {
94
+ public fun compare (other : ColumnSchema , comparisonMode : ComparisonMode = STRICT_FOR_NESTED_SCHEMAS ): CompareResult {
96
95
if (kind != other.kind) return CompareResult .None
97
96
if (this == = other) return CompareResult .Equals
98
97
return when (this ) {
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ import kotlin.reflect.full.isSubtypeOf
10
10
inline fun <reified T > DataFrame<T>.compareSchemas (strict : Boolean = false) {
11
11
val schema = schema()
12
12
val compileTimeSchema = compileTimeSchema()
13
- val compare = compileTimeSchema.compare(schema)
14
- require(if (strict) compare.isEqual() else compare.isSuperOrEqual()) {
13
+ val compare = compileTimeSchema.compare(schema, if (strict) ComparisonMode . STRICT else ComparisonMode . LENIENT )
14
+ require(compare.isSuperOrEqual()) {
15
15
buildString {
16
16
appendLine(" Comparison result: $compare " )
17
17
appendLine(" Runtime:" )
You can’t perform that action at this time.
0 commit comments