liuyongvs commented on code in PR #24015:
URL: https://github.com/apache/flink/pull/24015#discussion_r1439142391


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/agg/AggsHandlerCodeGenerator.scala:
##########
@@ -1230,8 +1232,26 @@ class AggsHandlerCodeGenerator(
       needReset: Boolean = false,
       needEmitValue: Boolean = false): Unit = {
     // check and validate the needed methods
+    aggBufferCodeGens.zipWithIndex.foreach {
+      case (aggBufferCodeGen, index) =>
+        aggBufferCodeGen.checkNeededMethods(
+          needAccumulate,
+          needRetract && aggCallNeedRetractions(index),
+          needMerge,

Review Comment:
    needRetract && index < aggCallNeedRetractions.length && 
aggCallNeedRetractions(index)
   1. if needRetract is true, aggCallNeedRetractions can not be null, because 
it will be set by needRetract(aggCallNeedRetractions: Array[Boolean]) and we 
should add index < aggCallNeedRetractions.length because aggCalls have basic 
functions , while  aggBufferCodeGens have 
   countStar/distinct code function
   3.  if needRetract is false, although aggCallNeedRetractions is null, but 
needRetract is false, will not run the logical of 
aggCallNeedRetractions(index),. so it will not throw NPE or OutofBoundArray 
Exception



-- 
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-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to