You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "twalthr (via GitHub)" <gi...@apache.org> on 2023/02/24 15:58:25 UTC
[GitHub] [flink] twalthr commented on a diff in pull request #21500: [FLINK-27995][table] Upgrade Janino version to 3.1.9
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-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org