Guest User

Untitled

a guest
Feb 11th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
  2. index 8ba1ccb..353b13d 100644
  3. --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
  4. +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
  5. @@ -21,7 +21,9 @@ package org.apache.hadoop.hbase.filter;
  6. import java.io.IOException;
  7. import java.util.ArrayList;
  8. import java.util.Arrays;
  9. +import java.util.HashSet;
  10. import java.util.List;
  11. +import java.util.Set;
  12.  
  13. import org.apache.hadoop.hbase.Cell;
  14. import org.apache.hadoop.hbase.CellComparator;
  15. @@ -67,7 +69,7 @@ final public class FilterList extends Filter {
  16. private static final int MAX_LOG_FILTERS = 5;
  17. private Operator operator = Operator.MUST_PASS_ALL;
  18. private List<Filter> filters = new ArrayList<Filter>();
  19. - private Filter seekHintFilter = null;
  20. + private Set<Filter> seekHintFilter = new HashSet<>();
  21.  
  22. /** Reference Cell used by {@link #transformCell(Cell)} for validation purpose. */
  23. private Cell referenceCell = null;
  24. @@ -173,7 +175,7 @@ final public class FilterList extends Filter {
  25. for (int i = 0; i < listize; i++) {
  26. filters.get(i).reset();
  27. }
  28. - seekHintFilter = null;
  29. + seekHintFilter.clear();
  30. }
  31.  
  32. @Override
  33. @@ -269,10 +271,15 @@ final public class FilterList extends Filter {
  34. transformed = filter.transformCell(transformed);
  35. continue;
  36. case SEEK_NEXT_USING_HINT:
  37. - seekHintFilter = filter;
  38. - return code;
  39. + seekHintFilter.add(filter);
  40. + continue;
  41. default:
  42. - return code;
  43. + if (seekHintFilter.isEmpty()) {
  44. + return code;
  45. + }
  46. + }
  47. + if (!seekHintFilter.isEmpty()) {
  48. + return ReturnCode.SEEK_NEXT_USING_HINT;
  49. }
  50. } else if (operator == Operator.MUST_PASS_ONE) {
  51. if (filter.filterAllRemaining()) {
  52. @@ -416,7 +423,16 @@ final public class FilterList extends Filter {
  53. public Cell getNextCellHint(Cell currentCell) throws IOException {
  54. Cell keyHint = null;
  55. if (operator == Operator.MUST_PASS_ALL) {
  56. - keyHint = seekHintFilter.getNextCellHint(currentCell);
  57. + for (Filter filter : seekHintFilter) {
  58. + Cell curKeyHint = filter.getNextCellHint(currentCell);
  59. + if (keyHint == null) {
  60. + keyHint = curKeyHint;
  61. + continue;
  62. + }
  63. + if (CellComparator.COMPARATOR.compare(keyHint, curKeyHint) < 0) {
  64. + keyHint = curKeyHint;
  65. + }
  66. + }
  67. return keyHint;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment