HADOOP-8866. SampleQuantiles#query is O(N^2) instead of O(N). Contributed by Andrew Wang.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1391711 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e8dc3b3a8a
commit
1ced82cc81
@ -280,6 +280,9 @@ Release 2.0.3-alpha - Unreleased
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-8866. SampleQuantiles#query is O(N^2) instead of O(N). (Andrew Wang
|
||||
via atm)
|
||||
|
||||
BUG FIXES
|
||||
|
||||
HADOOP-8795. BASH tab completion doesn't look in PATH, assumes path to
|
||||
|
@ -210,9 +210,12 @@ private long query(double quantile) throws IOException {
|
||||
int rankMin = 0;
|
||||
int desired = (int) (quantile * count);
|
||||
|
||||
ListIterator<SampleItem> it = samples.listIterator();
|
||||
SampleItem prev = null;
|
||||
SampleItem cur = it.next();
|
||||
for (int i = 1; i < samples.size(); i++) {
|
||||
SampleItem prev = samples.get(i - 1);
|
||||
SampleItem cur = samples.get(i);
|
||||
prev = cur;
|
||||
cur = it.next();
|
||||
|
||||
rankMin += prev.g;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user