GitHub user maropu opened a pull request:
https://github.com/apache/spark/pull/20024
[SPARK-22825][SQL] Fix incorrect results of Casting Array to String
## What changes were proposed in this pull request?
This pr fixed the issue when casting arrays into strings;
```
scala> val df =
spark.range(10).select('id.cast("integer")).agg(collect_list('id).as('ids))
scala> df.write.saveAsTable("t")
scala> sql("SELECT cast(ids as String) FROM t").show(false)
+------------------------------------------------------------------+
|ids |
+------------------------------------------------------------------+
|org.apache.spark.sql.catalyst.expressions.UnsafeArrayData@8bc285df|
+------------------------------------------------------------------+
```
## How was this patch tested?
Added tests in `CastSuite` and `SQLQuerySuite`.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/maropu/spark SPARK-22825
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/20024.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #20024
----
commit ed7f8857e54b0290cb136e9917f67a4809b3f138
Author: Takeshi Yamamuro <[email protected]>
Date: 2017-12-19T16:52:00Z
Fix a bug
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]