cloud-fan commented on a change in pull request #31201:
URL: https://github.com/apache/spark/pull/31201#discussion_r561858242
##########
File path:
external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala
##########
@@ -1261,6 +1262,58 @@ abstract class AvroSuite
}
}
+ test("Reading with user provided schema respects case sensitivity for field
matching") {
+ val wrongCaseSchema = new StructType()
+ .add("STRING", StringType, nullable = false)
+ .add("UNION_STRING_NULL", StringType, nullable = true)
+ val withSchema = spark.read
+ .schema(wrongCaseSchema)
+ .format("avro").load(testAvro).collect()
+
+ val withOutSchema = spark.read.format("avro").load(testAvro)
+ .select("STRING", "UNION_STRING_NULL")
+ .collect()
+ assert(withSchema.sameElements(withOutSchema))
+
+ withSQLConf((SQLConf.CASE_SENSITIVE.key, "true")) {
+ val out =
spark.read.format("avro").schema(wrongCaseSchema).load(testAvro).collect()
+ assert(out.forall(_.isNullAt(0)))
+ assert(out.forall(_.isNullAt(1)))
+ }
+ }
+
+ test("Writing with user provided schema respects case sensitivity for field
matching") {
Review comment:
ditto
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]