You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (Jira)" <ji...@apache.org> on 2019/11/08 07:46:00 UTC

[jira] [Updated] (SPARK-29776) rpad returning invalid value when parameter is empty

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

Hyukjin Kwon updated SPARK-29776:
---------------------------------
    Description: 
As per rpad definition
 rpad
 rpad(str, len, pad) - Returns str, right-padded with pad to a length of len
 If str is longer than len, the return value is shortened to len characters.
 *In case of empty pad string, the return value is null.*

Below is Example

In Spark:

{code}
0: jdbc:hive2://10.18.19.208:23040/default> SELECT rpad('hi', 5, '');
+----------------+
| rpad(hi, 5, ) |
+----------------+
| hi |
+----------------+
{code}

It should return NULL as per definition.

 

Hive behavior is correct as per definition it returns NULL when pad is empty String

INFO : Concurrency mode is disabled, not creating a lock manager
{code}
+-------+
| _c0 |
+-------+
| NULL |
+-------+
{code}

 

 

 

  was:
As per rpad definition
 rpad
 rpad(str, len, pad) - Returns str, right-padded with pad to a length of len
 If str is longer than len, the return value is shortened to len characters.
 *In case of empty pad string, the return value is null.*

Below is Example

In Spark:

0: jdbc:hive2://10.18.19.208:23040/default> SELECT rpad('hi', 5, '');
+----------------+
| rpad(hi, 5, ) |
+----------------+
| hi |
+----------------+

It should return NULL as per definition.

 

Hive behavior is correct as per definition it returns NULL when pad is empty String

INFO : Concurrency mode is disabled, not creating a lock manager
+-------+
| _c0 |
+-------+
| NULL |
+-------+

 

 

 


> rpad returning invalid value when parameter is empty
> ----------------------------------------------------
>
>                 Key: SPARK-29776
>                 URL: https://issues.apache.org/jira/browse/SPARK-29776
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: ABHISHEK KUMAR GUPTA
>            Priority: Major
>
> As per rpad definition
>  rpad
>  rpad(str, len, pad) - Returns str, right-padded with pad to a length of len
>  If str is longer than len, the return value is shortened to len characters.
>  *In case of empty pad string, the return value is null.*
> Below is Example
> In Spark:
> {code}
> 0: jdbc:hive2://10.18.19.208:23040/default> SELECT rpad('hi', 5, '');
> +----------------+
> | rpad(hi, 5, ) |
> +----------------+
> | hi |
> +----------------+
> {code}
> It should return NULL as per definition.
>  
> Hive behavior is correct as per definition it returns NULL when pad is empty String
> INFO : Concurrency mode is disabled, not creating a lock manager
> {code}
> +-------+
> | _c0 |
> +-------+
> | NULL |
> +-------+
> {code}
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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