hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng Shao (JIRA)" <j...@apache.org>
Subject [jira] Created: (HIVE-774) Fix the behavior of "/" and add "DIV"
Date Thu, 20 Aug 2009 01:03:15 GMT
Fix the behavior of "/" and add "DIV"
-------------------------------------

                 Key: HIVE-774
                 URL: https://issues.apache.org/jira/browse/HIVE-774
             Project: Hadoop Hive
          Issue Type: Bug
    Affects Versions: 0.4.0, 0.5.0
            Reporter: Zheng Shao


In hive, "select 3/2" will return 1 while MySQL returns 1.5.

See http://dev.mysql.com/doc/refman/5.0/en/arithmetic-functions.html#operator_div for details.

{code}
mysql> select 3/2;
+--------+
| 3/2    |
+--------+
| 1.5000 |
+--------+
1 row in set (0.00 sec)

mysql> select 3 div 2;
+---------+
| 3 div 2 |
+---------+
|       1 |
+---------+
1 row in set (0.00 sec)

mysql> select -3 div 2;
+----------+
| -3 div 2 |
+----------+
|       -1 |
+----------+
1 row in set (0.00 sec)

mysql> select -3 div -2;
+-----------+
| -3 div -2 |
+-----------+
|         1 |
+-----------+
1 row in set (0.00 sec)

mysql> select 3 div -2;
+----------+
| 3 div -2 |
+----------+
|       -1 |
+----------+
1 row in set (0.00 sec)
{code}


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


Mime
View raw message