Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/20306#discussion_r162293870
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
@@ -838,6 +839,7 @@ case class Cast(child: Expression, dataType: DataType,
timeZoneId: Option[String
|$evPrim = $buffer.build();
""".stripMargin
}
+ case pudt: PythonUserDefinedType => castToStringCode(pudt.sqlType,
ctx)
--- End diff --
You suggested like this?
https://github.com/apache/spark/compare/master...maropu:SPARK-23054-2
If so, this just dumps an internal structure;
```
scala> val df1 = Seq((1, Vectors.dense(Array(1.0, 2.0, 3.0)))).toDF("a",
"b")
scala> df1.selectExpr("CAST(b AS STRING)").show(false)
+----------------------+
|b |
+----------------------+
|[1,,, [1.0, 2.0, 3.0]]|
+----------------------+
scala> val df2 = Seq((1, Vectors.sparse(3, Array(0, 2), Array(1.0,
3.0)))).toDF("a", "b")
scala> df2.selectExpr("CAST(b AS STRING)").show(false)
+--------------------------+
|b |
+--------------------------+
|[0, 3, [0, 2], [1.0, 3.0]]|
+--------------------------+
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]