You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2014/01/14 07:50:01 UTC
svn commit: r1557948 -
/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
Author: larsh
Date: Tue Jan 14 06:50:01 2014
New Revision: 1557948
URL: http://svn.apache.org/r1557948
Log:
HBASE-10320 Avoid ArrayList.iterator() ExplicitColumnTracker
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java?rev=1557948&r1=1557947&r2=1557948&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java Tue Jan 14 06:50:01 2014
@@ -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 imple
* 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 imple
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 imple
* 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 imple
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 imple
}
// 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 imple
// 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 imple
// 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;