cloud-fan commented on a change in pull request #34154:
URL: https://github.com/apache/spark/pull/34154#discussion_r732584160
##########
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 byte sequence expressions the default padding expression is the byte
literal 0x00.
+ */
+object StringPadDefaultValue {
+ def get(str: Expression): Expression = {
+ str.dataType match {
+ case StringType => Literal(" ")
+ case BinaryType => Literal(Array[Byte](0x00))
Review comment:
is `0x00` a byte literal? is it better than `0.toByte`?
--
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]