sandip-db commented on code in PR #44571:
URL: https://github.com/apache/spark/pull/44571#discussion_r1443381162


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala:
##########
@@ -288,16 +253,15 @@ class XmlInferSchema(options: XmlOptions, caseSensitive: 
Boolean)
             case dt: DataType => dt
           }
           // Add the field and datatypes so that we can check if this is 
ArrayType.
-          val field = StaxXmlParserUtils.getName(e.asStartElement.getName, 
options)
           addOrUpdateType(nameToDataType, field, inferredType)
 
         case c: Characters if !c.isWhiteSpace =>
-          // This can be an attribute-only object
+          // This can be a value tag

Review Comment:
   ```suggestion
             // This is a value tag
   ```



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala:
##########
@@ -603,4 +518,17 @@ class XmlInferSchema(options: XmlOptions, caseSensitive: 
Boolean)
         newType
     }
   }
+
+  private[xml] def isPrimitiveType(dataType: DataType): Boolean = {
+    dataType match {
+      case _: StructType => false
+      case _: ArrayType => false
+      case _: MapType => false
+      case _ => true
+    }
+  }
+
+  private[xml] def isValueTagField(structField: StructField): Boolean = {
+    structField.name.toLowerCase(Locale.ROOT) == 
options.valueTag.toLowerCase(Locale.ROOT)

Review Comment:
   Shouldn't this be based on `caseSensitive` option?



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

Reply via email to