twalthr commented on code in PR #21500: URL: https://github.com/apache/flink/pull/21500#discussion_r1117229017
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGenUtils.scala: ########## @@ -1020,16 +1021,19 @@ object CodeGenUtils { } // convert internal format to target type - val externalResultTerm = if (isInternalClass(targetDataType)) { - s"($targetTypeTerm) ${internalExpr.resultTerm}" + val (externalResultTerm, resultType) = if (isInternalClass(targetDataType)) { Review Comment: can we use more meaningful names here? `resultType` does not improve code readability. `externalResultTypeTerm` is the right name here. ########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGenUtils.scala: ########## @@ -922,7 +922,8 @@ object CodeGenUtils { if (targetDataType.getConversionClass.isPrimitive) { externalResultTerm } else { - s"${internalExpr.nullTerm} ? null : ($externalResultTerm)" + // Cast of null is required because of janino issue https://github.com/janino-compiler/janino/issues/188 + s"${internalExpr.nullTerm} ? (${typeTerm(targetDataType.getConversionClass)}) null : ($externalResultTerm)" Review Comment: introduce a variable `externalResultTypeTerm = typeTerm(targetDataType.getConversionClass)` -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org