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

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

Github user ex00 commented on the issue:

    https://github.com/apache/flink/pull/2840
  
    Hi @StephanEwen
    I found a way check these changes via `TableTestBase`  how told @fhueske
    ```scala
    @Test
      def testAggregateQueryBatchSQL(): Unit = {
        val util = batchTestUtil()
        util.addTable[(Int, Long, Int)]("MyTable", 'a, 'b, 'c)
    
        val sqlQuery = (
          "SELECT avg(a),sum(b),count(c) FROM MyTable",
          "SELECT avg(a),sum(b),count(c) FROM MyTable WHERE a = 1"
        )
    
        val calcNode = unaryNode(
          "DataSetCalc",
          batchTableNode(0),
          term("select", "a", "b", "c"),
          term("where", "=(a, 1)")
        )
    
        val aggregate = (
          unaryNode(
            "DataSetAggregate",
            batchTableNode(0),
            term("select",
              "AVG(a) AS EXPR$0",
              "SUM(b) AS EXPR$1",
              "COUNT(c) AS EXPR$2")
          ),
          unaryNode(
            "DataSetAggregate",
            calcNode,
            term("select",
              "AVG(a) AS EXPR$0",
              "SUM(b) AS EXPR$1",
              "COUNT(c) AS EXPR$2")
          )
        )
        util.verifySql(sqlQuery._1, aggregate._1)
        util.verifySql(sqlQuery._2, aggregate._2)
      }
    ```` 
    but this test is checking only sql plan for aggregate query, and I will 
search other ways for check via unit tests.
    @StephanEwen, @fhueske, what is your oppinion on this case?


> Count/Sum 0 elements
> --------------------
>
>                 Key: FLINK-4832
>                 URL: https://issues.apache.org/jira/browse/FLINK-4832
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>            Reporter: Timo Walther
>            Assignee: Anton Mushin
>
> Currently, the Table API is unable to count or sum up 0 elements. We should 
> improve DataSet aggregations for this. Maybe by union the original DataSet 
> with a dummy record or by using a MapPartition function. Coming up with a 
> good design for this is also part of this issue.



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

Reply via email to