Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.1.0, 1.2.1
-
None
-
None
-
None
Description
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 ;
```