You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/29 12:53:45 UTC

[GitHub] [spark] wangyum commented on issue #25288: [SPARK-28036] [SQL] Built-in udf left/right has inconsistent behavior with postgresql

wangyum commented on issue #25288:  [SPARK-28036] [SQL] Built-in udf left/right has inconsistent behavior with postgresql
URL: https://github.com/apache/spark/pull/25288#issuecomment-515978968
 
 
   **Vertica**:
   ```sql
   dbadmin=> select left('ahoj', -2), right('ahoj', -2);
   ERROR 4039:  Negative substring length not allowed
   ```
   **DB2**:
   ```sql
   [db2inst1@2f3c821d36b7 ~]$ db2 "select left('ahoj', -2), right('ahoj', -2) from table (sysproc.env_get_inst_info())"
   SQL0138N  A numeric argument of a built-in string function is out of range.
   SQLSTATE=22011
   ```
   **SQLServer**:
   ```sql
   1> select left('ahoj', -2), right('ahoj', -2)
   2> go
   Msg 536, Level 16, State 6, Server 8c82b3c03354, Line 1
   Invalid length parameter passed to the left function.
   ```
   **TeraData**:
   ![image](https://user-images.githubusercontent.com/5399861/62049686-57139e80-b242-11e9-8d75-29c677aea2f8.png)
   **MariaDB**:
   ```
   MariaDB [(none)]> select left('ahoj', -2), right('ahoj', -2);
   +------------------+-------------------+
   | left('ahoj', -2) | right('ahoj', -2) |
   +------------------+-------------------+
   |                  |                   |
   +------------------+-------------------+
   1 row in set (0.000 sec)
   ```
   
   Thank you @LiShuMing. But I'm not sure if we need this fix. Most DBs are not allowed negative
   value.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org