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

Xuefu Zhang updated HIVE-5655:
------------------------------

    Description: 
Unlike other databases, Hive currently has only one mode (default mode) 
regarding error handling, in which NULL value is returned. However, in case of 
divide-by-zero, Hive demonstrated a different behavior.
{code}
hive> select 5/0 from tmp2 limit 1;
Total MapReduce jobs = 1
...
Total MapReduce CPU Time Spent: 860 msec
OK
Infinity
{code}

The correct behaviour should be Hive returning NULL instead in order to be 
consistent w.r.t error handling. (BTW, the same situation is handled corrected 
for decimal type.)

MySQL has server modes control the behaviour. By default, NULL is returned. For 
instance,
{code}
mysql> select 3/0 from dual;
+------+
| 3/0  |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
{code}

  was:
Unlike other databases, Hive currently has only one mode (default mode) 
regarding error handling, in which NULL value is returned. However, in case of 
divide-by-zero, Hive demonstrated a different behavior.
{code}
hive> select 5/0 from tmp2 limit 1;
Total MapReduce jobs = 1
...
Total MapReduce CPU Time Spent: 860 msec
OK
Infinity
{code}

The correct behaviour should be Hive returning NULL instead in order to be 
consistent w.r.t error handling. 

MySQL has server modes control the behaviour. By default, NULL is returned. For 
instance,
{code}
mysql> select 3/0 from dual;
+------+
| 3/0  |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
{code}


> Hive incorrecly handles divide-by-zero case
> -------------------------------------------
>
>                 Key: HIVE-5655
>                 URL: https://issues.apache.org/jira/browse/HIVE-5655
>             Project: Hive
>          Issue Type: Improvement
>          Components: Types
>    Affects Versions: 0.10.0, 0.11.0, 0.12.0
>            Reporter: Xuefu Zhang
>            Assignee: Xuefu Zhang
>
> Unlike other databases, Hive currently has only one mode (default mode) 
> regarding error handling, in which NULL value is returned. However, in case 
> of divide-by-zero, Hive demonstrated a different behavior.
> {code}
> hive> select 5/0 from tmp2 limit 1;
> Total MapReduce jobs = 1
> ...
> Total MapReduce CPU Time Spent: 860 msec
> OK
> Infinity
> {code}
> The correct behaviour should be Hive returning NULL instead in order to be 
> consistent w.r.t error handling. (BTW, the same situation is handled 
> corrected for decimal type.)
> MySQL has server modes control the behaviour. By default, NULL is returned. 
> For instance,
> {code}
> mysql> select 3/0 from dual;
> +------+
> | 3/0  |
> +------+
> | NULL |
> +------+
> 1 row in set (0.00 sec)
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to