HyukjinKwon commented on code in PR #47212:
URL: https://github.com/apache/spark/pull/47212#discussion_r1671585538
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala:
##########
@@ -3170,22 +3172,24 @@ abstract class CSVSuite
}
}
- test("SPARK-42237: change binary to unsupported dataType") {
- withTempPath { path =>
- val colName: String = "value"
- checkError(
- exception = intercept[AnalysisException] {
- Seq(Array[Byte](1, 2))
- .toDF(colName)
- .write
- .csv(path.getCanonicalPath)
- },
- errorClass = "UNSUPPORTED_DATA_TYPE_FOR_DATASOURCE",
- parameters = Map(
- "columnName" -> s"`$colName`",
- "columnType" -> "\"BINARY\"",
- "format" -> "CSV")
- )
+ test("SPARK-48807: Binary support for csv") {
+ BinaryOutputStyle.values.foreach { style =>
+ withTempPath { path =>
+ withSQLConf(SQLConf.BINARY_OUTPUT_STYLE.key -> style.toString) {
+ val df = Seq((1, "Spark SQL".getBytes())).toDF("id", "value")
+ df.write
+ .option("ds_option", "value")
+ .format(dataSourceFormat)
+ .save(path.getCanonicalPath)
+ val expectedStr = ToStringBase.getBinaryFormatter("Spark
SQL".getBytes())
Review Comment:
Can we change the value as non UTF8 output instead?
--
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]