hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Sedlak (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-5825) Case statement type checking too restrictive for parameterized types
Date Mon, 24 Mar 2014 20:46:44 GMT

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

Doug Sedlak commented on HIVE-5825:
-----------------------------------

Here is a possible instance of this issue, can you run this case to see it is addressed by
this JIRA in Hive 13?  Thanks!

Create a standard  textual linefeed delimited HDFS file with 1 row and  1 column, with contents
like:
FEB

Issue the following DDL against the above data, filling in location [hdfs_path] appropriately:
CREATE EXTERNAL TABLE `HIVE_5825` ( month VARCHAR(3) ) STORED AS TEXTFILE LOCATION [hdfs_path]

Issue the following SQL, which fails in Hive 12:
select case  when COUNT(*) > COUNT(`month`) then ' ' else MIN(`month`) end from HIVE_5825

The Hive 12 failure message generated is:
java.sql.SQLException: Error while processing statement: FAILED: SemanticException [Error
10016]: Line 1:57 Argument type mismatch '`month`': The expression after ELSE should have
the same type as those after THEN: "string" is expected but "varchar(3)" is found


> Case statement type checking too restrictive for parameterized types
> --------------------------------------------------------------------
>
>                 Key: HIVE-5825
>                 URL: https://issues.apache.org/jira/browse/HIVE-5825
>             Project: Hive
>          Issue Type: Bug
>          Components: UDF
>            Reporter: Jason Dere
>            Assignee: Jason Dere
>             Fix For: 0.13.0
>
>         Attachments: HIVE-5825.1.patch
>
>
> explain select
>   case when (key = '0') then 123.456BD else 0.0BD end
> from src limit 2
> FAILED: SemanticException [Error 10016]: Line 3:44 Argument type mismatch '0.0BD': The
expression after ELSE should have the same type as those after THEN: "decimal(6,3)" is expected
but "decimal(1,0)" is found
> The return type checking is too strict and won't allow different decimal types to be
returned if they are not the exact same type (precision/scale).  There are similar issues
with char/varchar length, but even in the general case it seems odd that you wouldn't be able
to specify 1 and 0.0 in the same case statement.
> I would propose setting returnOIResolver so that it is able to convert the return values
to common type.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message