maropu commented on a change in pull request #26477: [SPARK-29776][SQL] rpad 
should return NULL when padstring parameter is empty
URL: https://github.com/apache/spark/pull/26477#discussion_r361254457
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
 ##########
 @@ -1264,6 +1264,14 @@ case class StringRPad(str: Expression, len: Expression, 
pad: Expression = Litera
     this(str, len, Literal(" "))
   }
 
+  override def nullable: Boolean = if (pad != null) {
 
 Review comment:
   Like this?
   ```
     override def nullable: Boolean = children.exists(_.nullable) || {
       pad.foldable && pad.eval().asInstanceOf[UTF8String].numBytes() == 0
     }
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to