hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1449598 - in /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase: filter/Filter.java filter/FilterBase.java filter/FilterList.java filter/SkipFilter.java filter/WhileMatchFilter.java regionserver/HRegion.java
Date Mon, 25 Feb 2013 05:22:03 GMT
Author: tedyu
Date: Mon Feb 25 05:22:02 2013
New Revision: 1449598

URL: http://svn.apache.org/r1449598
Log:
HBASE-7920 Move isFamilyEssential(byte[] name) out of Filter interface in 0.94 (Ted Yu)


Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/Filter.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/Filter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/Filter.java?rev=1449598&r1=1449597&r2=1449598&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/Filter.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/Filter.java Mon Feb 25
05:22:02 2013
@@ -167,12 +167,4 @@ public interface Filter extends Writable
    * not sure which key to seek to next.
    */
   public KeyValue getNextKeyHint(final KeyValue currentKV);
-
-  /**
-   * Check that given column family is essential for filter to check row.  Most
-   * filters always return true here. But some could have more sophisticated
-   * logic which could significantly reduce scanning process by not even
-   * touching columns until we are 100% sure that it's data is needed in result.
-   */
-  public boolean isFamilyEssential(byte[] name);
 }

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java?rev=1449598&r1=1449597&r2=1449598&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java Mon Feb
25 05:22:02 2013
@@ -131,14 +131,29 @@ public abstract class FilterBase impleme
   }
 
   /**
+   * Check that given column family is essential for filter to check row.  Most
+   * filters always return true here. But some could have more sophisticated
+   * logic which could significantly reduce scanning process by not even
+   * touching columns until we are 100% sure that it's data is needed in result.
+   *
    * By default, we require all scan's column families to be present. Our
    * subclasses may be more precise.
-   *
-   * @inheritDoc
    */
   public boolean isFamilyEssential(byte[] name) {
     return true;
   }
+  
+  /**
+   * Check that given column family is essential for filter to check row.
+   * This accommodates Filter implementation which didn't have this capability
+   * 
+   * @param filter
+   * @param name column family name
+   * @return whether column family is essential
+   */
+  public static boolean isFamilyEssential(Filter filter, byte[] name) {
+    return !(filter instanceof FilterBase) || ((FilterBase) filter).isFamilyEssential(name);
+  }
 
   /**
    * Given the filter's arguments it constructs the filter

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java?rev=1449598&r1=1449597&r2=1449598&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java Mon Feb
25 05:22:02 2013
@@ -316,10 +316,9 @@ public class FilterList implements Filte
     return keyHint;
   }
 
-  @Override
   public boolean isFamilyEssential(byte[] name) {
     for (Filter filter : filters) {
-      if (filter.isFamilyEssential(name)) {
+      if (FilterBase.isFamilyEssential(filter, name)) {
         return true;
       }
     }

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java?rev=1449598&r1=1449597&r2=1449598&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/SkipFilter.java Mon Feb
25 05:22:02 2013
@@ -105,7 +105,7 @@ public class SkipFilter extends FilterBa
   }
 
   public boolean isFamilyEssential(byte[] name) {
-    return filter.isFamilyEssential(name);
+    return FilterBase.isFamilyEssential(this.filter, name);
   }
 
   @Override

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java?rev=1449598&r1=1449597&r2=1449598&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java
Mon Feb 25 05:22:02 2013
@@ -106,7 +106,7 @@ public class WhileMatchFilter extends Fi
   }
 
   public boolean isFamilyEssential(byte[] name) {
-    return filter.isFamilyEssential(name);
+    return FilterBase.isFamilyEssential(this.filter, name);
   }
 
   @Override

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1449598&r1=1449597&r2=1449598&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Mon
Feb 25 05:22:02 2013
@@ -98,6 +98,7 @@ import org.apache.hadoop.hbase.client.co
 import org.apache.hadoop.hbase.client.coprocessor.ExecResult;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
 import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.FilterBase;
 import org.apache.hadoop.hbase.filter.IncompatibleFilterException;
 import org.apache.hadoop.hbase.filter.WritableByteArrayComparable;
 import org.apache.hadoop.hbase.io.HeapSize;
@@ -3573,7 +3574,7 @@ public class HRegion implements HeapSize
         Store store = stores.get(entry.getKey());
         KeyValueScanner scanner = store.getScanner(scan, entry.getValue());
         if (this.filter == null || !scan.doLoadColumnFamiliesOnDemand()
-          || this.filter.isFamilyEssential(entry.getKey())) {
+          || FilterBase.isFamilyEssential(this.filter, entry.getKey())) {
           scanners.add(scanner);
         } else {
           joinedScanners.add(scanner);



Mime
View raw message