Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/21712#discussion_r200056444
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
---
@@ -134,6 +134,26 @@ object Cast {
toPrecedence > 0 && fromPrecedence > toPrecedence
}
+ /**
+ * Returns true iff we can safely cast the `from` type to `to` type
without any truncating or
+ * precision lose, e.g. int -> long, date -> timestamp.
+ */
+ def canSafeCast(from: AtomicType, to: AtomicType): Boolean = (from, to)
match {
--- End diff --
Is this only applied for `AtomicType`?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]