HyukjinKwon commented on code in PR #53687:
URL: https://github.com/apache/spark/pull/53687#discussion_r2663005153
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JsonInferSchema.scala:
##########
@@ -56,6 +56,22 @@ class JsonInferSchema(private val options: JSONOptions)
extends Serializable wit
isParsing = true,
forTimestampNTZ = true)
+ private lazy val dateFormatter = DateFormatter(
+ options.dateFormatInRead,
+ options.locale,
+ legacyFormat = FAST_DATE_FORMAT,
+ isParsing = true)
+
+// Similar to tryParseDate in CSVInferSchema.scala
+ private def tryParseDate(field: String): DataType = {
+ if (options.dateFormatInRead.isDefined &&
+ (allCatch opt dateFormatter.parse(field)).isDefined) {
Review Comment:
It's been quite old so I need to dig deeper but basically I think we decided
to don't do this IIRC cuz the performance impact is too large.
--
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]