dbatomic commented on code in PR #44004:
URL: https://github.com/apache/spark/pull/44004#discussion_r1406452281


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala:
##########
@@ -139,6 +128,31 @@ object RaiseError {
     new RaiseError(errorClass, parms)
 }
 
+/**
+ * Throw with the result of an expression (used for debugging).
+ */
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+  usage = "_FUNC_( expr ) - Throws a USER_RAISED_EXCEPTION with `expr` as 
message.",
+  examples = """
+    Examples:
+      > SELECT _FUNC_('custom error message');
+       [USER_RAISED_EXCEPTION] custom error message
+  """,
+  since = "3.1.0",
+  group = "misc_funcs")
+// scalastyle:on line.size.limit
+object RaiseErrorExpressionBuilder extends ExpressionBuilder {

Review Comment:
   In my offline discussion with @cloud-fan we tried to come with a way to 
achieve following:
   1) Leave RaiseError class intact so internally we can throw errors of custom 
class.
   2) Externally allow only raise_error('message') API.
   
   My understanding is that `expression[RaiseError]("raise_error")` ends up 
doing reflection that would expose a function for every constructor signature 
in RaiseError, meaning that we will expose both `def this(str: Expression)` and 
  `def this(errorClass: Expression, errorParms: Expression)` from `RaiseError`.
   
   Instead of doing this, we take ExpressionBuilder path that will expose only 
single argument version.



-- 
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-unsubscr...@spark.apache.org

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