cloud-fan commented on a change in pull request #27537:
[SPARK-30668][SQL][FOLLOWUP] Raise exception instead of silent change for new
DateFormatter
URL: https://github.com/apache/spark/pull/27537#discussion_r387757465
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala
##########
@@ -2304,8 +2304,39 @@ abstract class CSVSuite extends QueryTest with
SharedSparkSession with TestCsvDa
test("SPARK-30960: parse date/timestamp string with legacy format") {
val ds = Seq("2020-1-12 3:23:34.12, 2020-1-12 T").toDS()
- val csv = spark.read.option("header", false).schema("t timestamp, d
date").csv(ds)
- checkAnswer(csv, Row(Timestamp.valueOf("2020-1-12 3:23:34.12"),
Date.valueOf("2020-1-12")))
+ Seq("legacy", "corrected").foreach { config =>
+ withSQLConf(SQLConf.LEGACY_TIME_PARSER_POLICY.key -> config) {
+ val csv = spark.read.option("header", false).schema("t timestamp, d
date").csv(ds)
+ checkAnswer(csv, Row(Timestamp.valueOf("2020-1-12 3:23:34.12"),
Date.valueOf("2020-1-12")))
+ }
+ }
+ withSQLConf(SQLConf.LEGACY_TIME_PARSER_POLICY.key -> "exception") {
+ val msg = intercept[SparkException] {
+ val csv = spark.read.option("header", false).schema("t timestamp, d
date").csv(ds)
Review comment:
it works with both legacy and corrected policy, but not exception?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]