cloud-fan commented on a change in pull request #28420:
URL: https://github.com/apache/spark/pull/28420#discussion_r422891646
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
##########
@@ -323,6 +324,19 @@ trait RuntimeReplaceable extends UnaryExpression with
Unevaluable {
// two `RuntimeReplaceable` are considered to be semantically equal if their
"child" expressions
// are semantically equal.
override lazy val canonicalized: Expression = child.canonicalized
+
+ /**
+ * Only used to generate SQL representation of this expression.
+ *
+ * Implementations should override this with original parameters
+ */
+ def exprsReplaced: Seq[Expression]
+
+ override def sql: String = mkString(exprsReplaced.map(_.sql))
+
+ def mkString(childrenString: Seq[String]): String = {
+ prettyName + childrenString.mkString("(", ", ", ")")
+ }
Review comment:
It's not about pretty or not. It's about consistency. If we call a
function with its alias name, then it will not use `PrettyAttribute` and the
string representation is different from if we call the function with the
original name.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]