Github user maropu commented on a diff in the pull request: https://github.com/apache/spark/pull/21770#discussion_r202562989 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala --- @@ -890,7 +890,7 @@ case class Cast(child: Expression, dataType: DataType, timeZoneId: Option[String case StringType => val intOpt = ctx.freshName("intOpt") (c, evPrim, evNull) => s""" - scala.Option<Integer> $intOpt = + scala.Option<Object> $intOpt = --- End diff -- I don't look into the bytecode that JDK compilers generate though, the type of the return value seems to be erased in the bytecode; ``` ... /* 045 */ scala.Option<Integer> intOpt_0 = /* 046 */ org.apache.spark.sql.catalyst.util.DateTimeUtils.stringToDate(((UTF8String) references[0] /* literal */)); /* 047 */ if (intOpt_0.isDefined()) { /* 048 */ value_1 = ((Integer) intOpt_0.get()).intValue(); /* 049 */ } else { /* 050 */ isNull_1 = true; /* 051 */ } /* 052 */ ... - Day / DayOfMonth *** FAILED *** Code generation of dayofmonth(cast(2000-02-29 as date)) failed: java.util.concurrent.ExecutionException: org.codehaus.commons.compiler.CompileException: failed to compile: (Line 67, Column 62) incompatible types: scala.Option<java.lang.Object> cannot be converted to scala.Option<java.lang.Integer> java.util.concurrent.ExecutionException: org.codehaus.commons.compiler.CompileException: failed to compile: (Line 67, Column 62) incompatible types: scala.Option<java.lang.Object> cannot be converted to scala.Option<java.lang.Integer> at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:306) at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:293) at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116) ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org