You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/06/04 13:16:21 UTC

[GitHub] [flink] wuchong commented on a change in pull request #12303: [FLINK-17625] [table] Fix ArrayIndexOutOfBoundsException in AppendOnlyTopNFunction

wuchong commented on a change in pull request #12303:
URL: https://github.com/apache/flink/pull/12303#discussion_r435243944



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/operators/rank/AppendOnlyTopNFunction.java
##########
@@ -210,14 +210,19 @@ private void processElementWithoutRowNumber(RowData input, Collector<RowData> ou
 			RowData lastKey = lastEntry.getKey();
 			List<RowData> lastList = (List<RowData>) lastEntry.getValue();
 			// remove last one
-			RowData lastElement = lastList.remove(lastList.size() - 1);
-			if (lastList.isEmpty()) {
+			int size = lastList.size();
+			RowData lastElement = null;
+			if (size > 0) {
+				lastElement = lastList.get(size - 1);

Review comment:
       ```suggestion
   				lastElement = lastList.remove(size - 1);
   ```




----------------------------------------------------------------
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.

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