Skip to content

Commit 790a100

Browse files
committed
#710 Make the schema change comparison case sensitive for notification purposes.
We want to know when schema changes even if the change is casing of fields.
1 parent 80fbbae commit 790a100

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pramen/core/src/main/scala/za/co/absa/pramen/core/utils/SparkUtils.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ object SparkUtils {
175175
}
176176

177177
def processStruct(schema1: StructType, schema2: StructType, path: String = ""): Unit = {
178-
val fields1 = schema1.fields.map(f => (f.name.toLowerCase, f)).toMap
179-
val fields2 = schema2.fields.map(f => (f.name.toLowerCase, f)).toMap
178+
val fields1 = schema1.fields.map(f => (f.name, f)).toMap
179+
val fields2 = schema2.fields.map(f => (f.name, f)).toMap
180180

181181
val newColumns: Array[FieldChange] = schema2.fields
182182
.filter(f => !fields1.contains(f.name))
@@ -218,10 +218,8 @@ object SparkUtils {
218218
(array1.elementType, array2.elementType) match {
219219
case (st1: StructType, st2: StructType) =>
220220
processStruct(st1, st2, s"$path[].")
221-
Seq.empty
222221
case (ar1: ArrayType, ar2: ArrayType) =>
223222
processArray(ar1, ar2, metadata1, metadata2, s"$path[]")
224-
Seq.empty
225223
case _ =>
226224
val dt1 = dataTypeToString(array1, metadata1)
227225
val dt2 = dataTypeToString(array2, metadata2)

pramen/core/src/test/scala/za/co/absa/pramen/core/tests/utils/SparkUtilsSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class SparkUtilsSuite extends AnyWordSpec with SparkTestBase with TempDirFixture
304304
StructField("error_info", StructType(Seq(
305305
StructField("reason", StringType, nullable = true),
306306
StructField("value", StringType, nullable = true)
307-
))),
307+
)))
308308
))
309309

310310
val schema2 = StructType(Seq(

0 commit comments

Comments
 (0)