cloud-fan commented on a change in pull request #30614:
URL: https://github.com/apache/spark/pull/30614#discussion_r540737843
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
##########
@@ -64,38 +64,81 @@ case class PrintToStderr(child: Expression) extends
UnaryExpression {
custom error message
""",
since = "3.1.0")
-case class RaiseError(child: Expression) extends UnaryExpression with
ImplicitCastInputTypes {
+case class RaiseError(child: Expression, error: Option[Throwable] = None)
+ extends UnaryExpression with ImplicitCastInputTypes {
+
+ def this(child: Expression) = this(child, None)
- override def foldable: Boolean = false
override def nullable: Boolean = true
override def dataType: DataType = NullType
override def inputTypes: Seq[AbstractDataType] = Seq(StringType)
override def prettyName: String = "raise_error"
+ private def errorHashCode: Int = error match {
+ case Some(err) => 31 * err.getClass.hashCode() + err.getMessage.hashCode
+ case None => 0
+ }
+
+ override def hashCode(): Int = 31 * child.hashCode() + errorHashCode
+
+ private def errorEquals(other: Option[Throwable]): Boolean = (error, other)
match {
+ case (Some(e), Some(o)) => e.getClass == o.getClass && e.getMessage ==
o.getMessage
Review comment:
is this to skip comparing the stacktrace?
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]