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_r306708242
########## 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: BTW I'm not sure if we need `walkedTypePath`. `Upcast` needs it because it needs to record the field path in a class. I think for `AssignableCast` we only need to record the column name. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org