You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/18 03:41:08 UTC

[GitHub] [spark] AngersZhuuuu commented on a change in pull request #35534: [SPARK-38240][SQL] Improve RuntimeReplaceable and add a guideline for adding new functions

AngersZhuuuu commented on a change in pull request #35534:
URL: https://github.com/apache/spark/pull/35534#discussion_r809638749



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala
##########
@@ -110,19 +108,19 @@ case class TryAdd(left: Expression, right: Expression, child: Expression)
   since = "3.2.0",
   group = "math_funcs")
 // scalastyle:on line.size.limit
-case class TryDivide(left: Expression, right: Expression, child: Expression)
-    extends RuntimeReplaceable {
-  def this(left: Expression, right: Expression) =
+case class TryDivide(left: Expression, right: Expression, replacement: Expression)
+  extends RuntimeReplaceableInheritingTypeCoercion {
+  def this(left: Expression, right: Expression) = {

Review comment:
       Can remove the `{}`

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
##########
@@ -126,8 +126,8 @@ object RaiseError {
   """,
   since = "2.0.0",
   group = "misc_funcs")
-case class AssertTrue(left: Expression, right: Expression, child: Expression)
-  extends RuntimeReplaceable {
+case class AssertTrue(left: Expression, right: Expression, replacement: Expression)
+  extends RuntimeReplaceableInheritingTypeCoercion {

Review comment:
       Do we need to remain such constructor for such cases?
   
   Why not just like
   ```
   case class AssertTrue(left: Expression, right: Expression)
     extends RuntimeReplaceableInheritingTypeCoercion {
       lazy val replacement: Expression = If(left, Literal(null), RaiseError(right))
   ```




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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