shujingyang-db commented on code in PR #44163: URL: https://github.com/apache/spark/pull/44163#discussion_r1414754388
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlInferSchema.scala: ########## @@ -120,9 +136,27 @@ class XmlInferSchema(options: XmlOptions, caseSensitive: Boolean) val rootAttributes = StaxXmlParserUtils.gatherRootAttributes(parser) Some(inferObject(parser, rootAttributes)) } catch { - case NonFatal(_) if options.parseMode == PermissiveMode => - Some(StructType(Seq(StructField(options.columnNameOfCorruptRecord, StringType)))) - case NonFatal(_) => + case e @ (_: XMLStreamException | _: MalformedInputException | _: SAXException) => + handleXmlErrorsByParseMode(options.parseMode, options.columnNameOfCorruptRecord, e) Review Comment: yeah, we guard it by NonFatal errors at the end of this code block. Does it look good to you? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org