maropu commented on a change in pull request #31052:
URL: https://github.com/apache/spark/pull/31052#discussion_r553689092



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -51,18 +58,209 @@ object QueryExecutionErrors {
       s"[BUG] logical plan should not have output of char/varchar type: $leaf")
   }
 
-  def cannotEvaluateGeneratorError(generator: UnresolvedGenerator): Throwable 
= {
-    new UnsupportedOperationException(s"Cannot evaluate expression: 
$generator")
+  def cannotEvaluateExpressionError(expression: Expression): Throwable = {
+    new UnsupportedOperationException(s"Cannot evaluate expression: 
$expression")
   }
 
-  def cannotGenerateCodeForGeneratorError(generator: UnresolvedGenerator): 
Throwable = {
-    new UnsupportedOperationException(s"Cannot generate code for expression: 
$generator")
+  def cannotGenerateCodeForExpressionError(expression: Expression): Throwable 
= {
+    new UnsupportedOperationException(s"Cannot generate code for expression: 
$expression")
   }
 
   def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable 
= {
     new UnsupportedOperationException(s"Cannot terminate expression: 
$generator")
   }
 
+  def castDownLongCauseOverflowError(t: Any, targetType: String): Throwable = {
+    new ArithmeticException(s"Casting $t to $targetType causes overflow")
+  }
+
+  def cannotRepresentDecimalError(value: Decimal, decimalType: DecimalType): 
Throwable = {
+    new ArithmeticException(s"${value.toDebugString} cannot be represented as 
" +
+      s"Decimal(${decimalType.precision}, ${decimalType.scale}).")
+  }
+
+  def invalidInputSyntaxError(s: UTF8String): Throwable = {
+    new NumberFormatException(s"invalid input syntax for type numeric: $s")
+  }
+
+  def cannotCastFromNullTypeDirectlyError(to: DataType): Throwable = {
+    new SparkException(s"should not directly cast from NullType to $to.")
+  }
+
+  def cannotCastError(from: DataType, to: DataType): Throwable = {
+    new SparkException(s"Cannot cast $from to $to.")
+  }
+
+  def cannotParseDecimalError(): Throwable = {
+    new IllegalArgumentException("Cannot parse any decimal")
+  }
+
+  def simpleStringWithNodeIdUnsupportedError(nodeName: String): Throwable = {
+    new UnsupportedOperationException(s"$nodeName does not implement 
simpleStringWithNodeId")
+  }
+
+  def evaluateUnevaluableAggregateUnsupportedError(

Review comment:
       unsupportedEvaluateUnevaluableAggregateError? (Basically, its better to 
use `unsupported` for the prefix?)




----------------------------------------------------------------
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]

Reply via email to