HBASE-10320 Avoid ArrayList.iterator() ExplicitColumnTracker

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1557948 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
larsh 2014-01-14 06:50:01 +00:00
parent 5f9ef02234
commit 086b0ebcb6
1 changed files with 9 additions and 10 deletions

View File

@ -19,8 +19,6 @@
package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.NavigableSet;
import org.apache.hadoop.classification.InterfaceAudience;
@ -63,7 +61,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
* Each ColumnCount instance also tracks how many versions of the requested
* column have been returned.
*/
private final List<ColumnCount> columns;
private final ColumnCount[] columns;
private int index;
private ColumnCount column;
/** Keeps track of the latest timestamp included for current column.
@ -84,9 +82,10 @@ public class ExplicitColumnTracker implements ColumnTracker {
this.maxVersions = maxVersions;
this.minVersions = minVersions;
this.oldestStamp = oldestUnexpiredTS;
this.columns = new ArrayList<ColumnCount>(columns.size());
this.columns = new ColumnCount[columns.size()];
int i=0;
for(byte [] column : columns) {
this.columns.add(new ColumnCount(column));
this.columns[i++] = new ColumnCount(column);
}
reset();
}
@ -95,7 +94,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
* Done when there are no more columns to match against.
*/
public boolean done() {
return this.index >= this.columns.size();
return this.index >= columns.length;
}
public ColumnCount getColumnHint() {
@ -151,7 +150,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
return ScanQueryMatcher.MatchCode.SEEK_NEXT_ROW; // done_row
}
// This is the recursive case.
this.column = this.columns.get(this.index);
this.column = this.columns[this.index];
}
} while(true);
}
@ -178,7 +177,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
}
// We are done with current column; advance to next column
// of interest.
this.column = this.columns.get(this.index);
this.column = this.columns[this.index];
return ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL;
}
setTS(timestamp);
@ -188,7 +187,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
// Called between every row.
public void reset() {
this.index = 0;
this.column = this.columns.get(this.index);
this.column = this.columns[this.index];
for(ColumnCount col : this.columns) {
col.setCount(0);
}
@ -231,7 +230,7 @@ public class ExplicitColumnTracker implements ColumnTracker {
// Will not hit any more columns in this storefile
this.column = null;
} else {
this.column = this.columns.get(this.index);
this.column = this.columns[this.index];
}
if (compare <= -1)
continue;