Furcy Pin created HIVE-12028:
--------------------------------
Summary: An empty array is of type Array<String> and incompatible
with other array types
Key: HIVE-12028
URL: https://issues.apache.org/jira/browse/HIVE-12028
Project: Hive
Issue Type: Bug
Affects Versions: 1.2.1, 1.1.0
Reporter: Furcy Pin
How to reproduce:
```sql
SELECT ARRAY(ARRAY(1),ARRAY()) ;
FAILED: SemanticException [Error 10016]: Line 1:22 Argument type mismatch
'ARRAY': Argument type "array<string>" is different from preceding arguments.
Previous type was "array<int>"
SELECT COALESCE(ARRAY(1),ARRAY()) ;
FAILED: SemanticException [Error 10016]: Line 1:25 Argument type mismatch
'ARRAY': The expressions after COALESCE should all have the same type:
"array<int>" is expected but "array<string>" is found
```
This is especially painful for COALESCE, as we cannot
remove NULLS after doing a JOIN.
The same problem holds with maps.
The only workaround I could think of (except adding my own UDF)
is quite ugly :
```sql
SELECT ARRAY(ARRAY(1),empty.arr) FROM (SELECT collect_set(id) as arr FROM
(SELECT 1 as id) T WHERE id=0) empty ;
```
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)