This is an automated email from the ASF dual-hosted git repository. openinx pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push: new 1443694 HBASE-21734 Some optimization in FilterListWithOR 1443694 is described below commit 1443694f89fb33e0be12e1bec0ca4619fe37542a Author: huzheng <open...@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); } }