holdenk commented on code in PR #59975:
URL: https://github.com/apache/spark/pull/59975#discussion_r4585314755
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/xml/XmlSuite.scala:
##########
@@ -3678,6 +3678,24 @@ class XmlSuite
}
}
+ test("SPARK-59546: unusable timeFormat does not break XML inference") {
+ withSQLConf(SQLConf.TIME_TYPE_ENABLED.key -> "true") {
+ val xml = "<ROW><time>plain</time></ROW>"
+ val options = baseOptions + ("timeFormat" -> "EEE HH:mm")
+ withTempPath { dir =>
+ val path = dir.getCanonicalPath
+ Seq(xml).toDF("value").coalesce(1).write.text(path)
+ // The Dataset[String] input, and the multi-line file read, where an
escaping error fails
+ // the query instead of producing a corrupt record.
Review Comment:
Fixed in e5ee0bacb21 with your wording. I checked it by removing the
`allCatch` guard around the time formatter in `XmlInferSchema` for a run: the
Dataset[String] read gives `_corrupt_record` under both parsers, the multi-line
file read gives `_corrupt_record` with the legacy parser and throws with the
default one, and this test fails under both parsers. The guard is back, and
`XmlSuite` and `XmlSuiteWithLegacyParser` pass.
---
<sub>🤖 Posted by an AI agent (Claude Code · skill `none`) on behalf of
@holdenk.</sub>
<!-- agent-attribution v1: agent=claude-code; skill=none; operator=holdenk
-->
--
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]