Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/21193#discussion_r186630643 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala --- @@ -623,8 +624,14 @@ case class Cast(child: Expression, dataType: DataType, timeZoneId: Option[String override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = { val eval = child.genCode(ctx) val nullSafeCast = nullSafeCastFunction(child.dataType, dataType, ctx) + + // Below the code comment including `eval.value` and `eval.isNull` is a trick. It makes the two + // expr values are referred by this code block. ev.copy(code = eval.code + - castCode(ctx, eval.value, eval.isNull, ev.value, ev.isNull, dataType, nullSafeCast)) + code""" + // Cast from ${eval.value}, ${eval.isNull} --- End diff -- let's hold it and see what others think about.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org