Skip to content

Commit

Permalink
Parquet : Changing non-null to nullable (and vice versa) should yield…
Browse files Browse the repository at this point in the history
… nullable (close #151)
  • Loading branch information
voropaevp committed Apr 18, 2023
1 parent b1173ca commit ae27078
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ object Migrations {
case Type.Array(targetElement, targetNullability) =>
val mergedNullable = if (sourceNullability.nullable & targetNullability.required) {
migrations += RequiredNullable("[arrayDown]" :: path)
Type.Nullability.Required
Type.Nullability.Nullable
} else if (sourceNullability.required & targetNullability.nullable) {
migrations += NullableRequired("[arrayDown]" :: path)
Type.Nullability.Required
Type.Nullability.Nullable
} else if (sourceNullability.required & targetNullability.required) {
Type.Nullability.Required
} else {
Expand Down Expand Up @@ -148,10 +148,10 @@ object Migrations {
}
val mergedNullability: Type.Nullability = if (sourceField.nullability.nullable & targetField.nullability.required) {
migrations += RequiredNullable(path)
Type.Nullability.Required
Type.Nullability.Nullable
} else if (sourceField.nullability.required & targetField.nullability.nullable) {
migrations += NullableRequired(path)
Type.Nullability.Required
Type.Nullability.Nullable
} else if (sourceField.nullability.required & targetField.nullability.required) {
Type.Nullability.Required
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class MigrationSpec extends org.specs2.Specification {
""".stripMargin)
val schema2 = Field.build("top", input2, enforceValuePresence = false)

Migrations.mergeSchemas(schema1, schema2).leftMap(_.toString) should beRight(schema2) and (
Migrations.mergeSchemas(schema1, schema2).leftMap(_.toString) should beRight(schema1) and (
Migrations.assessSchemaMigration(schema1, schema2).map(_.toString) shouldEqual Set(
"Changing nullable property to required at /arrayKey/[arrayDown]/nestedKey2"
))
Expand Down

0 comments on commit ae27078

Please sign in to comment.