subhramit commented on code in PR #58226:
URL: https://github.com/apache/spark/pull/58226#discussion_r3960645746
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala:
##########
@@ -3095,6 +3095,38 @@ abstract class CSVSuite
}
}
+ test("SPARK-58946: reject file extensions that are not exactly three
letters") {
+ Seq("abcd", "ab1", "a").foreach { ext =>
+ withTempPath { path =>
+ checkError(
+ exception = intercept[SparkIllegalArgumentException] {
+ spark.range(1).write.option("extension",
ext).csv(path.getAbsolutePath)
+ },
+ condition = "INVALID_PARAMETER_VALUE.EXTENSION",
+ parameters = Map(
+ "functionName" -> "`csv`",
+ "parameter" -> "`extension`",
+ "invalidValue" -> s"`$ext`"))
+ }
+ }
+ }
+
+ test("SPARK-58946: reject file extensions containing path separators") {
+ val ext = "a/b"
+
+ withTempPath { path =>
+ checkError(
+ exception = intercept[SparkIllegalArgumentException] {
+ spark.range(1).write.option("extension",
ext).csv(path.getAbsolutePath)
+ },
+ condition = "INVALID_PARAMETER_VALUE.EXTENSION",
+ parameters = Map(
+ "functionName" -> "`csv`",
+ "parameter" -> "`extension`",
+ "invalidValue" -> s"`$ext`"))
+ }
+ }
Review Comment:
@tdcmeehan I had that idea initially, but then do you think we need to
change the test description as well,
`"SPARK-58946: reject file extensions that are not exactly three letters"`
--
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]