cloud-fan commented on code in PR #37486:
URL: https://github.com/apache/spark/pull/37486#discussion_r944332623


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/TryCastSuite.scala:
##########
@@ -17,30 +17,50 @@
 
 package org.apache.spark.sql.catalyst.expressions
 
+import scala.reflect.ClassTag
+
 import org.apache.spark.SparkFunSuite
 import org.apache.spark.sql.catalyst.InternalRow
 import org.apache.spark.sql.catalyst.util.DateTimeTestUtils.UTC_OPT
 import org.apache.spark.sql.types._
 import org.apache.spark.unsafe.types.UTF8String
 
 // A test suite to check analysis behaviors of `TryCast`.
-class TryCastSuite extends SparkFunSuite {
+class TryCastSuite extends CastWithAnsiOnSuite {
+
+  override def evalMode: EvalMode.Value = EvalMode.TRY
 
-  private def cast(v: Any, targetType: DataType, timeZoneId: Option[String] = 
None): TryCast = {
+  override def cast(v: Any, targetType: DataType, timeZoneId: Option[String] = 
None): Cast = {
     v match {
-      case lit: Expression => TryCast(lit, targetType, timeZoneId)
-      case _ => TryCast(Literal(v), targetType, timeZoneId)
+      case lit: Expression => Cast(lit, targetType, timeZoneId, EvalMode.TRY)
+      case _ => Cast(Literal(v), targetType, timeZoneId, EvalMode.TRY)
     }
   }
 
+  override def checkExceptionInExpression[T <: Throwable : ClassTag](

Review Comment:
   It's a bit weird to have two different testing approaches for try_cast, but 
given that it was already the case before, I don't have a strong opinion.



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

Reply via email to