File tree Expand file tree Collapse file tree 4 files changed +11
-12
lines changed
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe Expand file tree Collapse file tree 4 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,13 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup
34
34
import org.jetbrains.kotlinx.dataframe.impl.toSnakeCase
35
35
import org.jetbrains.kotlinx.dataframe.keywords.HardKeywords
36
36
import org.jetbrains.kotlinx.dataframe.keywords.ModifierKeywords
37
+ import org.jetbrains.kotlinx.dataframe.schema.ComparisonMode
37
38
import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema
38
39
39
40
private fun renderNullability (nullable : Boolean ) = if (nullable) " ?" else " "
40
41
41
42
internal fun Iterable<Marker>.filterRequiredForSchema (schema : DataFrameSchema ) =
42
- filter { it.isOpen && it.schema.compare(schema).isSuperOrEqual() }
43
+ filter { it.isOpen && it.schema.compare(schema, ComparisonMode . STRICT_FOR_NESTED_SCHEMAS ).isSuperOrEqual() }
43
44
44
45
internal val charsToQuote = """ [ `(){}\[\].<>'"/|\\!?@:;%^&*#$-]""" .toRegex()
45
46
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import org.jetbrains.kotlinx.dataframe.codeGen.MarkerVisibility
7
7
import org.jetbrains.kotlinx.dataframe.codeGen.SchemaProcessor
8
8
import org.jetbrains.kotlinx.dataframe.codeGen.ValidFieldName
9
9
import org.jetbrains.kotlinx.dataframe.schema.ColumnSchema
10
+ import org.jetbrains.kotlinx.dataframe.schema.ComparisonMode
10
11
import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema
11
12
12
13
internal class SchemaProcessorImpl (
@@ -23,7 +24,7 @@ internal class SchemaProcessorImpl(
23
24
24
25
private fun DataFrameSchema.getAllSuperMarkers () =
25
26
registeredMarkers
26
- .filter { it.isOpen && it.schema.compare(this ).isSuperOrEqual() }
27
+ .filter { it.isOpen && it.schema.compare(this , ComparisonMode . STRICT_FOR_NESTED_SCHEMAS ).isSuperOrEqual() }
27
28
28
29
private fun List<Marker>.onlyLeafs (): List <Marker > {
29
30
val skip = flatMap { it.allSuperMarkers.keys }.toSet()
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public sealed class ColumnSchema {
57
57
override val nullable: Boolean = false
58
58
override val type: KType get() = typeOf<AnyRow >()
59
59
60
- public fun compare (other : Group , comparisonMode : ComparisonMode = STRICT_FOR_NESTED_SCHEMAS ): CompareResult =
60
+ public fun compare (other : Group , comparisonMode : ComparisonMode = LENIENT ): CompareResult =
61
61
schema.compare(
62
62
other = other.schema,
63
63
comparisonMode = comparisonMode,
@@ -91,7 +91,7 @@ public sealed class ColumnSchema {
91
91
}
92
92
}
93
93
94
- public fun compare (other : ColumnSchema , comparisonMode : ComparisonMode = STRICT_FOR_NESTED_SCHEMAS ): CompareResult {
94
+ public fun compare (other : ColumnSchema , comparisonMode : ComparisonMode = LENIENT ): CompareResult {
95
95
if (kind != other.kind) return CompareResult .None
96
96
if (this == = other) return CompareResult .Equals
97
97
return when (this ) {
Original file line number Diff line number Diff line change 1
1
package org.jetbrains.kotlinx.dataframe.schema
2
2
3
- import org.jetbrains.kotlinx.dataframe.schema.ComparisonMode.STRICT_FOR_NESTED_SCHEMAS
4
-
5
3
public interface DataFrameSchema {
6
4
7
5
public val columns: Map <String , ColumnSchema >
8
6
9
7
/* *
10
- * By default generated markers for leafs aren't used as supertypes: @DataSchema(isOpen = false)
11
- * [ComparisonMode.STRICT_FOR_NESTED_SCHEMAS] takes this into account for internal codegen logic
8
+ * @param comparisonMode The [mode][ComparisonMode] to compare the schema's by.
9
+ * By default, generated markers for leafs aren't used as supertypes: `@DataSchema(isOpen = false)`
10
+ * Setting [comparisonMode] to [ComparisonMode.STRICT_FOR_NESTED_SCHEMAS] takes this into account
11
+ * for internal codegen logic.
12
12
*/
13
- public fun compare (
14
- other : DataFrameSchema ,
15
- comparisonMode : ComparisonMode = STRICT_FOR_NESTED_SCHEMAS ,
16
- ): CompareResult
13
+ public fun compare (other : DataFrameSchema , comparisonMode : ComparisonMode = ComparisonMode .LENIENT ): CompareResult
17
14
}
You can’t perform that action at this time.
0 commit comments