[ 
https://issues.apache.org/jira/browse/FLINK-9332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472026#comment-16472026
 ] 

ASF GitHub Bot commented on FLINK-9332:
---------------------------------------

Github user Xpray commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5988#discussion_r187636663
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/CallGenerator.scala
 ---
    @@ -64,17 +65,28 @@ object CallGenerator {
     
         val (auxiliaryStmt, result) = call(operands.map(_.resultTerm))
     
    +    val nullTermCode = if (
    +      nullCheck &&
    +      isReference(returnType) &&
    +      !TypeCheckUtils.isTemporal(returnType)) {
    +      s"""
    +         |if ($resultTerm == null) {
    +         |  $nullTerm = true;
    +         |}
    +       """.stripMargin
    +    } else {
    +      ""
    +    }
    +
         val resultCode = if (nullCheck && operands.nonEmpty) {
           s"""
             |${operands.map(_.code).mkString("\n")}
             |boolean $nullTerm = ${operands.map(_.nullTerm).mkString(" || ")};
    -        |$resultTypeTerm $resultTerm;
    -        |if ($nullTerm) {
    -        |  $resultTerm = $defaultValue;
    --- End diff --
    
    I've set the value to defaultValue at line 85


> Fix Codegen error of CallGenerator  
> ------------------------------------
>
>                 Key: FLINK-9332
>                 URL: https://issues.apache.org/jira/browse/FLINK-9332
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>            Reporter: Ruidong Li
>            Assignee: Ruidong Li
>            Priority: Major
>
> function call may return null, but nullTerm did not handle it correctly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to