[
https://issues.apache.org/jira/browse/HIVE-512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12733103#action_12733103
]
Min Zhou commented on HIVE-512:
-------------------------------
If you inspected the implementation of case, you will know it's unacceptable to
case with different types of arguments.
see: GenericUDFCase.java , GenericUDFWhen.java
{code}
hive> select case when true then '2' else 3 end from pokes limit 1;
FAILED: Error in semantic analysis: line 1:36 Argument Type Mismatch 3: The
expression after ELSE should have the same type as those after THEN: "string"
is expected but "int" is found
{code}
elt is a string function, confusion will be caused if we casually change its
behavior. It no need make things more complex.
> [GenericUDF] new string function ELT(N,str1,str2,str3,...)
> -----------------------------------------------------------
>
> Key: HIVE-512
> URL: https://issues.apache.org/jira/browse/HIVE-512
> Project: Hadoop Hive
> Issue Type: New Feature
> Components: Query Processor
> Affects Versions: 0.4.0
> Reporter: Min Zhou
> Assignee: Min Zhou
> Fix For: 0.4.0
>
> Attachments: HIVE-512.2.patch, HIVE-512.patch
>
>
> ELT(N,str1,str2,str3,...)
> Returns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is less
> than 1 or greater than the number of arguments. ELT() is the complement of
> FIELD().
> {noformat}
> mysql> SELECT ELT(1, 'ej', 'Heja', 'hej', 'foo');
> -> 'ej'
> mysql> SELECT ELT(4, 'ej', 'Heja', 'hej', 'foo');
> -> 'foo'
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.