hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Navis (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-12028) An empty array is of type Array<String> and incompatible with other array types
Date Wed, 14 Oct 2015 02:19:05 GMT

    [ https://issues.apache.org/jira/browse/HIVE-12028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14956146#comment-14956146
] 

Navis commented on HIVE-12028:
------------------------------

looks like "cast null as int"

> 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.1.0, 1.2.1
>            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)

Mime
View raw message