You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ka...@apache.org on 2016/09/25 12:21:35 UTC
[2/4] storm git commit: [STORM-2118] address review comments
[STORM-2118] address review comments
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/324a9dd3
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/324a9dd3
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/324a9dd3
Branch: refs/heads/1.x-branch
Commit: 324a9dd36a80eb26a51214bba086369f3debf47d
Parents: 3001638
Author: Arun Mahadevan <ar...@apache.org>
Authored: Fri Sep 23 11:27:45 2016 +0530
Committer: Jungtaek Lim <ka...@gmail.com>
Committed: Sun Sep 25 21:19:43 2016 +0900
----------------------------------------------------------------------
.../src/test/org/apache/storm/sql/TestUtils.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/324a9dd3/external/sql/storm-sql-runtime/src/test/org/apache/storm/sql/TestUtils.java
----------------------------------------------------------------------
diff --git a/external/sql/storm-sql-runtime/src/test/org/apache/storm/sql/TestUtils.java b/external/sql/storm-sql-runtime/src/test/org/apache/storm/sql/TestUtils.java
index 9eceaf5..58c3f26 100644
--- a/external/sql/storm-sql-runtime/src/test/org/apache/storm/sql/TestUtils.java
+++ b/external/sql/storm-sql-runtime/src/test/org/apache/storm/sql/TestUtils.java
@@ -67,10 +67,17 @@ public class TestUtils {
return new PriorityQueue<>();
}
public static PriorityQueue<Integer> add(PriorityQueue<Integer> accumulator, Integer n, Integer val) {
+ if (n <= 0) {
+ return accumulator;
+ }
if (accumulator.size() >= n) {
- accumulator.remove();
+ if (val > accumulator.peek()) {
+ accumulator.remove();
+ accumulator.add(val);
+ }
+ } else {
+ accumulator.add(val);
}
- accumulator.add(val);
return accumulator;
}
public static List<Integer> result(PriorityQueue<Integer> accumulator) {