flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-2210) Table API aggregate by ignoring null values
Date Tue, 16 Jun 2015 07:08:00 GMT

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

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

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

    https://github.com/apache/flink/pull/834#discussion_r32495592
  
    --- Diff: flink-staging/flink-table/src/main/scala/org/apache/flink/api/table/codegen/ExpressionCodeGenerator.scala
---
    @@ -489,6 +489,25 @@ abstract class ExpressionCodeGenerator[R](
                 """.stripMargin
             }
     
    +      case NumericIsNotNull(child) =>
    +        val childCode = generateExpression(child)
    +        if (nullCheck) {
    +          childCode.code +
    +            s"""
    +               |boolean $nullTerm = ${childCode.nullTerm};
    +               |if ($nullTerm) {
    +               |  0;
    +               |} else {
    +               |  $resultTpe $resultTerm = Boolean.compare((${childCode.resultTerm} !=
null),false);
    --- End diff --
    
    Boolean.compare() could be problematic because it is only guaranteed to return a value
smaller than 0 or larger then 0 if the two values are not equal.
    
    What about?
    ```
    $resultTpe $resultTerm = ${childCode.resultTerm} != null ? 1 : 0;


> Table API aggregate by ignoring null values
> -------------------------------------------
>
>                 Key: FLINK-2210
>                 URL: https://issues.apache.org/jira/browse/FLINK-2210
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Shiti Saxena
>            Assignee: Shiti Saxena
>            Priority: Minor
>
> Attempting to aggregate on columns which may have null values results in NullPointerException.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message