diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala index 25f33e7f1bbdf..467fbe868be84 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala @@ -214,12 +214,11 @@ private[sql] class XmlInferSchema(options: XmlOptions, caseSensitive: Boolean) * In case-insensitive mode, we will infer an array named by foo * (as it's the first one we encounter) */ - val caseSensitivityOrdering: Ordering[String] = (x: String, y: String) => - if (caseSensitive) { - x.compareTo(y) - } else { - x.compareToIgnoreCase(y) - } + val caseSensitivityOrdering: Ordering[String] = if (caseSensitive) { + (x: String, y: String) => x.compareTo(y) + } else { + (x: String, y: String) => x.compareToIgnoreCase(y) + } val nameToDataType = collection.mutable.TreeMap.empty[String, DataType](caseSensitivityOrdering)