HyukjinKwon commented on a change in pull request #35534:
URL: https://github.com/apache/spark/pull/35534#discussion_r809596037
##########
File path:
examples/src/main/scala/org/apache/spark/examples/extensions/AgeExample.scala
##########
@@ -18,14 +18,15 @@
package org.apache.spark.examples.extensions
import org.apache.spark.sql.catalyst.expressions.{CurrentDate, Expression,
RuntimeReplaceable, SubtractDates}
+import org.apache.spark.sql.catalyst.trees.UnaryLike
/**
* How old are you in days?
*/
-case class AgeExample(birthday: Expression, child: Expression) extends
RuntimeReplaceable {
-
- def this(birthday: Expression) = this(birthday, SubtractDates(CurrentDate(),
birthday))
- override def exprsReplaced: Seq[Expression] = Seq(birthday)
-
- override protected def withNewChildInternal(newChild: Expression):
Expression = copy(newChild)
+case class AgeExample(birthday: Expression) extends RuntimeReplaceable with
UnaryLike[Expression] {
+ lazy val replacement: Expression = SubtractDates(CurrentDate(), birthday)
Review comment:
I think it's best to add `override` explicitly.
--
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]