You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "javeme (via GitHub)" <gi...@apache.org> on 2023/02/27 14:53:48 UTC

[GitHub] [incubator-hugegraph] javeme commented on a diff in pull request #2134: chore: cmn algorithm optimization

javeme commented on code in PR #2134:
URL: https://github.com/apache/incubator-hugegraph/pull/2134#discussion_r1118856686


##########
hugegraph-core/src/main/java/org/apache/hugegraph/backend/tx/GraphIndexTransaction.java:
##########
@@ -1120,21 +1120,25 @@ private static <T> boolean cmn(List<T> all, int m, int n,
             result = new ArrayList<>(n);
         }
 
+        int index = result.size();
         if (m == n) {
             result.addAll(all.subList(current, all.size()));
             n = 0;
         }
         if (n == 0) {
             // All n items are selected
-            return callback.apply(result);
+            Boolean apply = callback.apply(result);
+            while (index < result.size()) {
+                result.remove(index);

Review Comment:
   when to cause this behavior?



-- 
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: dev-unsubscribe@hugegraph.apache.org

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