gengliangwang commented on PR #37283: URL: https://github.com/apache/spark/pull/37283#issuecomment-1195528067
> Hmm does it matter? The point is Cast expression itself knows if it's from table insertion or not, and we can customize Cast behavior with this information, like different error messages for both compile time and runtime errors. We don't need a new variant of Cast expression. Oh you meant changing the implementation of `Cast`. That's how I started. However, there are byte/short/int/long/decimal to take care, and there are codegen/eval methods. So we will have to modify 10 methods. Take castToInt and castToIntCode as example: https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L862 https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L2093 The approach of this PR is neat and simple. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
