yaooqinn commented on a change in pull request #28420:
URL: https://github.com/apache/spark/pull/28420#discussion_r420022388



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
##########
@@ -323,6 +324,20 @@ 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
+   */
+  protected def exprsReplaced: Seq[Expression]
+
+  override def sql: String = prettyName + 
exprsReplaced.map(_.sql).mkString("(", ", ", ")")
+
+  protected def prettySQL: String =
+    prettyName + exprsReplaced.map(toPrettySQL).mkString("(", ", ", ")")
+
+  def asPrettyAttribute(): PrettyAttribute = PrettyAttribute(prettySQL, 
dataType)

Review comment:
       I think it might be better to move this to `util.package`




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



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

Reply via email to