MaxGekk commented on issue #27438: [MINOR][SQL][DOCS][2.4] Fix the timestamp pattern in the example for `to_timestamp` URL: https://github.com/apache/spark/pull/27438#issuecomment-581837184 > maybe we can just fix the issue in to_timestamp after RC2 passes? @cloud-fan I have tried to port all functions on `TimestampParser` by rewriting `DateTimeUtils.newDateFormat`: ```scala def newDateFormat(formatString: String, timeZone: TimeZone): TimestampParser = { new TimestampParser(FastDateFormat.getInstance(formatString, timeZone)) } ``` from ```scala def newDateFormat(formatString: String, timeZone: TimeZone): DateFormat = { val sdf = new SimpleDateFormat(formatString, Locale.US) sdf.setTimeZone(timeZone) // Enable strict parsing, if the input date/format is invalid, it will throw an exception. // e.g. to parse invalid date '2016-13-12', or '2016-01-12' with invalid format 'yyyy-aa-dd', // an exception will be throwed. sdf.setLenient(false) sdf } ``` but I got a few test failures due to strict mode set via **`sdf.setLenient(false)`**. I haven't found a way to set similar mode for `FastDateFormat`.
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org