You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fh...@apache.org on 2017/11/08 17:42:00 UTC

[3/5] flink git commit: [FLINK-7971] [table] Fix potential NPE in non-windowed aggregation.

[FLINK-7971] [table] Fix potential NPE in non-windowed aggregation.

This closes #4941.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/9d20e898
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/9d20e898
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/9d20e898

Branch: refs/heads/master
Commit: 9d20e898c846cca117efd2a246f82c0374fcbda2
Parents: cd53251
Author: Xpray <le...@gmail.com>
Authored: Fri Nov 3 15:19:42 2017 +0800
Committer: Fabian Hueske <fh...@apache.org>
Committed: Wed Nov 8 17:12:18 2017 +0100

----------------------------------------------------------------------
 .../flink/table/runtime/aggregate/GroupAggProcessFunction.scala | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/9d20e898/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GroupAggProcessFunction.scala
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GroupAggProcessFunction.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GroupAggProcessFunction.scala
index 91c379f..3970320 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GroupAggProcessFunction.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/GroupAggProcessFunction.scala
@@ -97,11 +97,14 @@ class GroupAggProcessFunction(
     if (null == accumulators) {
       firstRow = true
       accumulators = function.createAccumulators()
-      inputCnt = 0L
     } else {
       firstRow = false
     }
 
+    if (null == inputCnt) {
+      inputCnt = 0L
+    }
+
     // Set group keys value to the final output
     function.setForwardedFields(input, newRow.row)
     function.setForwardedFields(input, prevRow.row)