Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/14829#discussion_r76417772
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala
---
@@ -681,6 +680,20 @@ class CSVSuite extends QueryTest with SharedSQLContext
with SQLTestUtils {
Seq((1, Array("Tesla", "Chevy", "Ford"))).toDF("id",
"brands").write.csv(csvDir)
}.getMessage
assert(msg.contains("CSV data source does not support array<string>
data type"))
+
+ msg = intercept[UnsupportedOperationException] {
+ Seq((1, new UDT.MyDenseVector(Array(0.25, 2.25,
4.25)))).toDF("id", "vectors")
+ .write.csv(csvDir)
+ }.getMessage
+ assert(msg.contains("CSV data source does not support array<double>
data type"))
+
+ // Read should fail for UDT.
+ msg = intercept[SparkException] {
+ val schema = StructType(StructField("a", new
UDT.MyDenseVectorUDT(), true) :: Nil)
+ spark.range(1).write.csv(csvDir)
+ spark.read.schema(schema).csv(csvDir).collect()
+ }.getCause.getMessage
--- End diff --
I know adding opposite cases for tests is not quite good but I had to do
this to avoid defining another UDT here. If you think it is okay to define
another one, I will do so.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]