You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by op...@apache.org on 2019/01/22 03:41:43 UTC
[hbase] branch master updated: HBASE-21734 Some optimization in
FilterListWithOR
This is an automated email from the ASF dual-hosted git repository.
openinx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new b0131e1 HBASE-21734 Some optimization in FilterListWithOR
b0131e1 is described below
commit b0131e19f4b9ced05f501c61596191cb8a86b660
Author: huzheng <op...@gmail.com>
AuthorDate: Thu Jan 17 21:57:30 2019 +0800
HBASE-21734 Some optimization in FilterListWithOR
---
.../org/apache/hadoop/hbase/filter/FilterListBase.java | 15 ++++++++++-----
.../org/apache/hadoop/hbase/filter/FilterListWithOR.java | 3 +--
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java
index d6bb75c..ad24d0e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java
@@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.apache.hadoop.hbase.Cell;
@@ -49,7 +48,12 @@ public abstract class FilterListBase extends FilterBase {
}
protected static boolean isInReturnCodes(ReturnCode testRC, ReturnCode... returnCodes) {
- return Arrays.stream(returnCodes).anyMatch(testRC::equals);
+ for (ReturnCode rc : returnCodes) {
+ if (testRC == rc) {
+ return true;
+ }
+ }
+ return false;
}
protected static boolean checkAndGetReversed(List<Filter> rowFilters, boolean defaultValue) {
@@ -57,9 +61,10 @@ public abstract class FilterListBase extends FilterBase {
return defaultValue;
}
boolean retValue = rowFilters.get(0).isReversed();
- boolean allEqual = rowFilters.stream().allMatch(f -> f.isReversed() == retValue);
- if (!allEqual) {
- throw new IllegalArgumentException("Filters in the list must have the same reversed flag");
+ for (int i = 1, n = rowFilters.size(); i < n; i++) {
+ if (rowFilters.get(i).isReversed() != retValue) {
+ throw new IllegalArgumentException("Filters in the list must have the same reversed flag");
+ }
}
return retValue;
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java
index ba4cd88..28540a4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java
@@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.filter;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.KeyValueUtil;
import org.apache.yetus.audience.InterfaceAudience;
import java.io.IOException;
@@ -254,7 +253,7 @@ public class FilterListWithOR extends FilterListBase {
// need not save current cell to prevCellList for saving heap memory.
prevCellList.set(index, null);
} else {
- prevCellList.set(index, KeyValueUtil.toNewKeyCell(currentCell));
+ prevCellList.set(index, currentCell);
}
}