GitHub user liutang123 opened a pull request:
https://github.com/apache/spark/pull/21100
[SPARK-24012][SQL] Union of map and other compatible column
## What changes were proposed in this pull request?
Union of map and other compatible column result in unresolved operator
'Union; exception
Reproduction
`spark-sql>select map(1,2), 'str' union all select map(1,2,3,null), 1`
Output:
```
Error in query: unresolved operator 'Union;;
'Union
:- Project [map(1, 2) AS map(1, 2)#106, str AS str#107]
: +- OneRowRelation$
+- Project [map(1, cast(2 as int), 3, cast(null as int)) AS map(1, CAST(2
AS INT), 3, CAST(NULL AS INT))#109, 1 AS 1#108]
+- OneRowRelation$
```
So, we should cast part of columns to be compatible when appropriate.
## How was this patch tested?
unit test
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liutang123/spark SPARK-24012
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/21100.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 #21100
----
commit a422a7f1c1fb0f055fbb8736a364c5a641afc2a9
Author: liutang123 <liutang123@...>
Date: 2018-04-18T14:29:15Z
[SPARK-24012][SQL] Union of map and other compatible column
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]