sandip-db commented on code in PR #43722:
URL: https://github.com/apache/spark/pull/43722#discussion_r1389999737
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala:
##########
@@ -45,7 +47,8 @@ private[sql] class XmlInferSchema(options: XmlOptions)
extends Serializable with
options.zoneId,
options.locale,
legacyFormat = FAST_DATE_FORMAT,
- isParsing = true)
+ isParsing = true
+ )
Review Comment:
revert this change
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala:
##########
@@ -200,7 +205,31 @@ private[sql] class XmlInferSchema(options: XmlOptions)
extends Serializable with
parser: XMLEventReader,
rootAttributes: Array[Attribute] = Array.empty): DataType = {
val builder = ArrayBuffer[StructField]()
- val nameToDataType = collection.mutable.Map.empty[String,
ArrayBuffer[DataType]]
+
+ /**
+ * Retrieves the field name with respect to the case sensitivity setting.
+ * We pick the first name we encountered.
+ *
+ * If case sensitivity is enabled, the original field name is returned.
+ * If not, the field name is managed in a case-insensitive map.
+ *
+ * For instance, if we encounter the following field names:
+ * foo, Foo, FOO
+ *
+ * In case-sensitive mode: we will infer three fields: foo, Foo, FOO
+ * 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)
Review Comment:
```suggestion
x.compareToIgnoreCase(y)
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]