[ 
https://issues.apache.org/jira/browse/HIVE-164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zheng Shao updated HIVE-164:
----------------------------

    Attachment: HIVE-164.8.patch

@Ashish: 
Implicit type conversion: Opened HIVE-450.
Nulls: We do allow Nulls: see ql/src/test/queries/clientpositive/udf_case.q. 
The reason that udf_case_type_wrong3.q does not work is because there is an INT 
after THEN and a STRING after ELSE.
Partition pruning and predicate push-down: Added ppd_udf_case.q and fixed ppd 
to handle GenericUDF
{code}
set hive.optimize.ppd=true;

EXPLAIN
SELECT *
FROM srcpart a JOIN srcpart b
ON a.key = b.key
WHERE a.ds = '2008-04-08' AND
      b.ds = '2008-04-08' AND
      CASE a.key
        WHEN '27' THEN TRUE
        WHEN '38' THEN FALSE
        ELSE NULL
       END
ORDER BY a.key, a.value, a.ds, a.hr, b.key, b.value, b.ds, b.hr;

SELECT *
FROM srcpart a JOIN srcpart b
ON a.key = b.key
WHERE a.ds = '2008-04-08' AND
      b.ds = '2008-04-08' AND
      CASE a.key
        WHEN '27' THEN TRUE
        WHEN '38' THEN FALSE
        ELSE NULL
       END
ORDER BY a.key, a.value, a.ds, a.hr, b.key, b.value, b.ds, b.hr;
{code}


@Namit:
Added udf_case_column_pruning.q
{code}
EXPLAIN
SELECT CASE a.key
        WHEN '1' THEN 2
        WHEN '3' THEN 4
        ELSE 5
       END as key
FROM src a JOIN src b
ON a.key = b.key
ORDER BY key LIMIT 10;

SELECT CASE a.key
        WHEN '1' THEN 2
        WHEN '3' THEN 4
        ELSE 5
       END as key
FROM src a JOIN src b
ON a.key = b.key
ORDER BY key LIMIT 10;
{code}


> Support CASE statement using GenericUDF
> ---------------------------------------
>
>                 Key: HIVE-164
>                 URL: https://issues.apache.org/jira/browse/HIVE-164
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>    Affects Versions: 0.4.0
>            Reporter: Zheng Shao
>            Assignee: Zheng Shao
>             Fix For: 0.4.0
>
>         Attachments: HIVE-164.4.patch, HIVE-164.5.patch, 
> HIVE-164.6.code-only.patch, HIVE-164.6.patch, HIVE-164.7.code-only.patch, 
> HIVE-164.7.patch, HIVE-164.8.patch
>
>
> See http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html for 
> details.
> Syntax:
> {code}
> CASE value WHEN [compare_value] THEN result [WHEN [compare_value] THEN result 
> ...] [<ELSE result] END
> CASE WHEN [condition] THEN result [WHEN [condition] THEN result ...] [ELSE 
> result] END 
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to