Skip to content

Commit

Permalink
remove legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
gengliangwang committed Apr 8, 2021
1 parent 9cb723a commit e028030
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package org.apache.spark.sql.catalyst.expressions

import org.apache.spark.sql.catalyst.expressions.codegen._
import org.apache.spark.sql.catalyst.expressions.codegen.Block._
import org.apache.spark.sql.types.{ArrayType, DataType, MapType, NullType, StructType}
import org.apache.spark.sql.types.DataType

/**
* A special version of [[AnsiCast]]. It performs the same operation (i.e. converts a value of
Expand Down Expand Up @@ -89,9 +89,5 @@ case class TryCast(child: Expression, dataType: DataType, timeZoneId: Option[Str
s"try_cast($child as ${dataType.simpleString})"
}

override def sql: String = dataType match {
case _: ArrayType | _: MapType | _: StructType => child.sql
case _: NullType => s"TRY_CAST(${child.sql} AS void)"
case _ => s"TRY_CAST(${child.sql} AS ${dataType.sql})"
}
override def sql: String = s"TRY_CAST(${child.sql} AS ${dataType.sql})"
}

0 comments on commit e028030

Please sign in to comment.