PHOENIX-1979 Remove unused FamilyOnlyFilter

Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a4b4e0e2
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a4b4e0e2
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a4b4e0e2

Branch: refs/heads/calcite
Commit: a4b4e0e2d862d5d4ee0f3a6f9587f53fe87d629f
Parents: c83ab9e
Author: Andrew Purtell <apurt...@apache.org>
Authored: Wed May 20 09:53:53 2015 -0700
Committer: Andrew Purtell <apurt...@apache.org>
Committed: Wed May 20 09:53:53 2015 -0700

----------------------------------------------------------------------
 .../index/covered/filter/FamilyOnlyFilter.java  |  80 --------------
 .../covered/filter/TestFamilyOnlyFilter.java    | 106 -------------------
 2 files changed, 186 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a4b4e0e2/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/FamilyOnlyFilter.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/FamilyOnlyFilter.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/FamilyOnlyFilter.java
deleted file mode 100644
index 68555ef..0000000
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/covered/filter/FamilyOnlyFilter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.hbase.index.covered.filter;
-
-import org.apache.hadoop.hbase.Cell;
-import org.apache.hadoop.hbase.filter.BinaryComparator;
-import org.apache.hadoop.hbase.filter.ByteArrayComparable;
-import org.apache.hadoop.hbase.filter.FamilyFilter;
-
-/**
- * Similar to the {@link FamilyFilter} but stops when the end of the family is 
reached and only
- * supports equality
- */
-public class FamilyOnlyFilter extends FamilyFilter {
-
-  boolean done = false;
-  private boolean previousMatchFound;
-
-  /**
-   * Filter on exact binary matches to the passed family
-   * @param family to compare against
-   */
-  public FamilyOnlyFilter(final byte[] family) {
-    this(new BinaryComparator(family));
-  }
-
-  public FamilyOnlyFilter(final ByteArrayComparable familyComparator) {
-    super(CompareOp.EQUAL, familyComparator);
-  }
-
-
-  @Override
-  public boolean filterAllRemaining() {
-    return done;
-  }
-
-  @Override
-  public void reset() {
-    done = false;
-    previousMatchFound = false;
-  }
-
-  @Override
-  public ReturnCode filterKeyValue(Cell v) {
-    if (done) {
-      return ReturnCode.SKIP;
-    }
-    ReturnCode code = super.filterKeyValue(v);
-    if (previousMatchFound) {
-      // we found a match before, and now we are skipping the key because of 
the family, therefore
-      // we are done (no more of the family).
-      if (code.equals(ReturnCode.SKIP)) {
-      done = true;
-      }
-    } else {
-      // if we haven't seen a match before, then it doesn't matter what we see 
now, except to mark
-      // if we've seen a match
-      if (code.equals(ReturnCode.INCLUDE)) {
-        previousMatchFound = true;
-      }
-    }
-    return code;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/a4b4e0e2/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/covered/filter/TestFamilyOnlyFilter.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/covered/filter/TestFamilyOnlyFilter.java
 
b/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/covered/filter/TestFamilyOnlyFilter.java
deleted file mode 100644
index 216f548..0000000
--- 
a/phoenix-core/src/test/java/org/apache/phoenix/hbase/index/covered/filter/TestFamilyOnlyFilter.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.phoenix.hbase.index.covered.filter;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.hadoop.hbase.KeyValue;
-import org.apache.hadoop.hbase.filter.Filter.ReturnCode;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.phoenix.hbase.index.covered.filter.FamilyOnlyFilter;
-import org.junit.Test;
-
-/**
- * Test that the family only filter only allows a single family through
- */
-public class TestFamilyOnlyFilter {
-
-  byte[] row = new byte[] { 'a' };
-  byte[] qual = new byte[] { 'b' };
-  byte[] val = Bytes.toBytes("val");
-
-  @Test
-  public void testPassesFirstFamily() {
-    byte[] fam = Bytes.toBytes("fam");
-    byte[] fam2 = Bytes.toBytes("fam2");
-
-    FamilyOnlyFilter filter = new FamilyOnlyFilter(fam);
-
-    KeyValue kv = new KeyValue(row, fam, qual, 10, val);
-    ReturnCode code = filter.filterKeyValue(kv);
-    assertEquals("Didn't pass matching family!", ReturnCode.INCLUDE, code);
-
-    kv = new KeyValue(row, fam2, qual, 10, val);
-    code = filter.filterKeyValue(kv);
-    assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, 
code);
-  }
-
-  @Test
-  public void testPassesTargetFamilyAsNonFirstFamily() {
-    byte[] fam = Bytes.toBytes("fam");
-    byte[] fam2 = Bytes.toBytes("fam2");
-    byte[] fam3 = Bytes.toBytes("way_after_family");
-
-    FamilyOnlyFilter filter = new FamilyOnlyFilter(fam2);
-
-    KeyValue kv = new KeyValue(row, fam, qual, 10, val);
-
-    ReturnCode code = filter.filterKeyValue(kv);
-    assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, 
code);
-
-    kv = new KeyValue(row, fam2, qual, 10, val);
-    code = filter.filterKeyValue(kv);
-    assertEquals("Didn't pass matching family", ReturnCode.INCLUDE, code);
-
-    kv = new KeyValue(row, fam3, qual, 10, val);
-    code = filter.filterKeyValue(kv);
-    assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, 
code);
-  }
-
-  @Test
-  public void testResetFilter() {
-    byte[] fam = Bytes.toBytes("fam");
-    byte[] fam2 = Bytes.toBytes("fam2");
-    byte[] fam3 = Bytes.toBytes("way_after_family");
-
-    FamilyOnlyFilter filter = new FamilyOnlyFilter(fam2);
-
-    KeyValue kv = new KeyValue(row, fam, qual, 10, val);
-
-    ReturnCode code = filter.filterKeyValue(kv);
-    assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, 
code);
-
-    KeyValue accept = new KeyValue(row, fam2, qual, 10, val);
-    code = filter.filterKeyValue(accept);
-    assertEquals("Didn't pass matching family", ReturnCode.INCLUDE, code);
-
-    kv = new KeyValue(row, fam3, qual, 10, val);
-    code = filter.filterKeyValue(kv);
-    assertEquals("Didn't filter out non-matching family!", ReturnCode.SKIP, 
code);
-
-    // we shouldn't match the family again - everything after a switched 
family should be ignored
-    code = filter.filterKeyValue(accept);
-    assertEquals("Should have skipped a 'matching' family if it arrives out of 
order",
-      ReturnCode.SKIP, code);
-
-    // reset the filter and we should accept it again
-    filter.reset();
-    code = filter.filterKeyValue(accept);
-    assertEquals("Didn't pass matching family after reset", 
ReturnCode.INCLUDE, code);
-  }
-}

Reply via email to