cloud-fan commented on a change in pull request #34154:
URL: https://github.com/apache/spark/pull/34154#discussion_r731831413



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
##########
@@ -1328,14 +1328,31 @@ case class StringLocate(substr: Expression, str: 
Expression, start: Expression)
 
 }
 
+/**
+ * Helper class for implementing StringLPad and StringRPad.
+ * Returns the default expression to be used in StringLPad or StringRPad based 
on the type of
+ * the input expression.
+ * For character string expressions the default padding expression is the 
string literal ' '.
+ * For binary string expressions the default padding expression is the byte 
literal 0x00.
+ */
+object StringPadDefaultValue {
+  def get(str: Expression): Expression = {
+    str.dataType match {

Review comment:
       One problem is that `str` may be unresolved and we can't call 
`str.dataType`. We need some indirection here so that we can go to the binary 
lpad/rpad code path during analysis.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to