grundprinzip commented on code in PR #38634:
URL: https://github.com/apache/spark/pull/38634#discussion_r1020780715
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala:
##########
@@ -499,6 +506,9 @@ case class Cast(
def this(child: Expression, dataType: DataType, timeZoneId: Option[String]) =
this(child, dataType, timeZoneId, evalMode =
EvalMode.fromSQLConf(SQLConf.get))
+ def this(child: Expression, dt: Expression) =
Review Comment:
This is the probably most interesting part of this change. Here, we simply
use the output type of the expression to determine what the target type of the
type cast is.
There is a similar piece of code in the `from_json` function which takes an
expression as the second parameter for the schema, but evaluates it to string
and then parses the string into the type.
--
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]