cloud-fan commented on a change in pull request #25239: [SPARK-28495][SQL]
AssignableCast: A new type coercion following store assignment rules of ANSI SQL
URL: https://github.com/apache/spark/pull/25239#discussion_r306707784
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -1407,3 +1440,12 @@ case class UpCast(child: Expression, dataType:
DataType, walkedTypePath: Seq[Str
extends UnaryExpression with Unevaluable {
override lazy val resolved = false
}
+
+/**
+ * Cast the child expression to the target data type, but will throw error if
the cast violates
+ * the store assignment rules of ANSI SQL, e.g. string -> int, array -> string.
+ */
+case class AssignableCast(child: Expression, dataType: DataType,
walkedTypePath: Seq[String] = Nil)
Review comment:
can we apply it for the v2 table insertion first? We probably need another
PR to apply it for v1 table insertion, as it's a behavior change and needs
migration guide.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]