Skip to content

Commit 5857c5d

Browse files
committed
fix build break
1 parent 4a43700 commit 5857c5d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CatalystTypeConverters.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ import java.sql.{Date, Timestamp}
2424
import java.time.{Duration, Instant, LocalDate, LocalDateTime, LocalTime, Period}
2525
import java.util.{Map => JavaMap}
2626
import javax.annotation.Nullable
27+
2728
import scala.language.existentials
29+
2830
import org.apache.spark.SparkIllegalArgumentException
2931
import org.apache.spark.sql.Row
3032
import org.apache.spark.sql.catalyst.expressions._
3133
import org.apache.spark.sql.catalyst.util._
32-
import org.apache.spark.sql.errors.{QueryCompilationErrors, QueryExecutionErrors}
34+
import org.apache.spark.sql.errors.QueryCompilationErrors
3335
import org.apache.spark.sql.internal.SQLConf
3436
import org.apache.spark.sql.types._
3537
import org.apache.spark.sql.types.DayTimeIntervalType._

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,14 @@ case class Cast(
611611
messageParameters = Map("other" -> other.toString))
612612
}
613613
if (canCast) {
614-
// If the cast is to a time type, we first need to check if the time type is enabled.
615-
case _: TimeType if !SQLConf.get.isTimeTypeEnabled =>
616-
throw QueryCompilationErrors.unsupportedTimeTypeError()
617-
// If the cast is not to a time type, we can skip the time type check and continue.
618-
case _ =>
619-
TypeCheckResult.TypeCheckSuccess
614+
dataType match {
615+
// If the cast is to a time type, we first need to check if the time type is enabled.
616+
case _: TimeType if !SQLConf.get.isTimeTypeEnabled =>
617+
throw QueryCompilationErrors.unsupportedTimeTypeError()
618+
// If the cast is not to a time type, we can skip the time type check and continue.
619+
case _ =>
620+
TypeCheckResult.TypeCheckSuccess
621+
}
620622
} else {
621623
typeCheckFailureInCast
622624
}

0 commit comments

Comments
 (0)