You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Lingang Deng (JIRA)" <ji...@apache.org> on 2017/07/12 07:56:00 UTC

[jira] [Created] (HIVE-17077) lpad(rpad) should return a value but not throw a exception

Lingang Deng created HIVE-17077:
-----------------------------------

             Summary: lpad(rpad) should return a value but not throw a exception
                 Key: HIVE-17077
                 URL: https://issues.apache.org/jira/browse/HIVE-17077
             Project: Hive
          Issue Type: Bug
            Reporter: Lingang Deng
            Assignee: Lingang Deng
            Priority: Minor


lpad(rpad) throw a exception when the second argument a negative number, as follows,
{code:java}
hive> select lpad("hello", -1 ,"h");
FAILED: StringIndexOutOfBoundsException String index out of range: -1
hive> select rpad("hello", -1 ,"h");
FAILED: StringIndexOutOfBoundsException String index out of range: -1
{code}
Maybe we should return friendly result such as mysql.
{code:java}
mysql> select lpad("hello", -1 ,"h");
+----------------------+
| lpad("hello", -1 ,"h") |
+----------------------+
| NULL                 |
+----------------------+
1 row in set (0.00 sec)

mysql> select rpad("hello", -1 ,"h");
+----------------------+
| rpad("hello", -1 ,"h") |
+----------------------+
| NULL                 |
+----------------------+
1 row in set (0.00 sec)
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)