spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] HyukjinKwon commented on a change in pull request #26477: [SPARK-29776][SQL] rpad and lpad should return NULL when padstring parameter is empty
Date Fri, 27 Dec 2019 03:46:44 GMT
HyukjinKwon commented on a change in pull request #26477: [SPARK-29776][SQL] rpad and lpad
should return NULL when padstring parameter is empty
URL: https://github.com/apache/spark/pull/26477#discussion_r361574560
 
 

 ##########
 File path: common/unsafe/src/test/java/org/apache/spark/unsafe/types/UTF8StringSuite.java
 ##########
 @@ -362,15 +362,15 @@ public void pad() {
 
     assertEquals(EMPTY_UTF8, fromString("数据砖头").lpad(-10, fromString("孙行者")));
     assertEquals(EMPTY_UTF8, fromString("数据砖头").lpad(-10, EMPTY_UTF8));
-    assertEquals(fromString("数据砖头"), fromString("数据砖头").lpad(5, EMPTY_UTF8));
-    assertEquals(fromString("数据砖"), fromString("数据砖头").lpad(3, EMPTY_UTF8));
-    assertEquals(EMPTY_UTF8, EMPTY_UTF8.lpad(3, EMPTY_UTF8));
+    assertEquals(fromString(null), fromString("数据砖头").lpad(5, EMPTY_UTF8));
+    assertEquals(fromString(null), fromString("数据砖头").lpad(3, EMPTY_UTF8));
+    assertEquals(fromString(null), EMPTY_UTF8.lpad(3, EMPTY_UTF8));
 
     assertEquals(EMPTY_UTF8, fromString("数据砖头").rpad(-10, fromString("孙行者")));
     assertEquals(EMPTY_UTF8, fromString("数据砖头").rpad(-10, EMPTY_UTF8));
-    assertEquals(fromString("数据砖头"), fromString("数据砖头").rpad(5, EMPTY_UTF8));
-    assertEquals(fromString("数据砖"), fromString("数据砖头").rpad(3, EMPTY_UTF8));
-    assertEquals(EMPTY_UTF8, EMPTY_UTF8.rpad(3, EMPTY_UTF8));
+    assertEquals(fromString(null), fromString("数据砖头").rpad(5, EMPTY_UTF8));
 
 Review comment:
   If that's the case, I am less sure why we should necessarily change. The lpad and rpad
implementations seem different per DBMS implementation. Spark's case at least has one reference
and the current behaviour makes sense as well.

----------------------------------------------------------------
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


Mime
View raw message