dongjoon-hyun commented on a change in pull request #32194:
URL: https://github.com/apache/spark/pull/32194#discussion_r614558228



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/SchemaPruningSuite.scala
##########
@@ -59,4 +69,28 @@ class SchemaPruningSuite extends SparkFunSuite {
       StructType.fromDDL("e int, f string")))
     testPrunedSchema(complexStruct, StructField("c", IntegerType), 
selectFieldInMap)
   }
+
+  test("SPARK-35096: test case insensitivity of pruned schema  ") {
+    Seq(true, false).foreach(isCaseSensitive => {
+      withSQLConf(CASE_SENSITIVE.key -> isCaseSensitive.toString) {
+        if (isCaseSensitive) {
+          val requestedFields = getRootFields(StructField("id", IntegerType))
+          val prunedSchema = SchemaPruning.pruneDataSchema(
+            StructType.fromDDL("ID int, name String"), requestedFields)
+          assert(prunedSchema == StructType(Seq.empty))
+        } else {
+          // Schema is case insensitive
+          val prunedSchema = SchemaPruning.pruneDataSchema(
+            StructType.fromDDL("ID int, name String"),
+            getRootFields(StructField("id", IntegerType)))
+          assert(prunedSchema == StructType(StructField("ID", IntegerType) :: 
Nil))
+          // Root fields are insensitive
+          val prunedSchema_1 = SchemaPruning.pruneDataSchema(

Review comment:
       Apache Spark has a scala style guideline for variable. We use 
`camelCase` naming instead of `_1`.
   - https://github.com/databricks/scala-style-guide#variable-naming




-- 
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]

Reply via email to