srielau commented on code in PR #42985:
URL: https://github.com/apache/spark/pull/42985#discussion_r1336596704
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala:
##########
@@ -61,64 +62,83 @@ case class PrintToStderr(child: Expression) extends
UnaryExpression {
/**
* Throw with the result of an expression (used for debugging).
*/
+// scalastyle:off line.size.limit
@ExpressionDescription(
- usage = "_FUNC_(expr) - Throws an exception with `expr`.",
+ usage = "_FUNC_( expr [, errorParams ]) - Throws a USER_RAISED_EXCEPTION
with `expr` as message, or a defined error class in `expr` with a parameter
map.",
examples = """
Examples:
> SELECT _FUNC_('custom error message');
- java.lang.RuntimeException
- custom error message
+ [USER_RAISED_EXCEPTION] custom error message
+
+ > SELECT _FUNC_('VIEW_NOT_FOUND', Map('relationName' -> '`V1`'));
Review Comment:
The only other choice I have is to treat it like an error class first, and
if I do not find any fall back to the default behavior.
But that is hardly better since it will not catch typos...
--
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]