Package org.apache.hadoop.hbase.filter

Examples of org.apache.hadoop.hbase.filter.Filter


    singleIndexExpression.setRangeExpression(re);

    Scan scan = new Scan();
    scan.setAttribute(Constants.INDEX_EXPRESSION, IndexUtils.toBytes(singleIndexExpression));
    FilterList fl = new FilterList(Operator.MUST_PASS_ALL);
    Filter filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER1, CompareOp.EQUAL, value1);
    fl.addFilter(filter);
    filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER2, CompareOp.EQUAL, value2);
    fl.addFilter(filter);
    filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER3, CompareOp.GREATER_OR_EQUAL, value3_1);
    fl.addFilter(filter);
View Full Code Here


    Scan scan = new Scan();
    scan.setAttribute(Constants.INDEX_EXPRESSION, IndexUtils.toBytes(multiIndexExpression));
    FilterList outerFL = new FilterList(Operator.MUST_PASS_ALL);
    FilterList fl = new FilterList(Operator.MUST_PASS_ALL);
    Filter filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER2, CompareOp.EQUAL, value2);
    fl.addFilter(filter);
    filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER3, CompareOp.GREATER_OR_EQUAL, value3_1);
    fl.addFilter(filter);
    filter = new SingleColumnValueFilter(FAMILY1, QUALIFIER3, CompareOp.LESS, value3_2);
    fl.addFilter(filter);
View Full Code Here

    public void doAnAction() throws Exception {
      Scan s = new Scan();
      for (byte[] family : targetFamilies) {
        s.addFamily(family);
      }
      Filter filter =
          new SingleColumnValueFilter(FAMILY_A, (Bytes.toString(QUALIFIER_NAME) + "1").getBytes(),
              CompareOp.EQUAL, data);
      s.setFilter(filter);
      ResultScanner scanner = table.getScanner(s);
View Full Code Here

    // test put with the indexed column
    Put p = new Put("row1".getBytes());
    p.add("col".getBytes(), "ql".getBytes(), "Val".getBytes());
    table.put(p);
    Scan s = new Scan();
    Filter filter = new ExceptionFilter();
    s.setFilter(filter);
    int i = 0;
    ResultScanner scanner = table.getScanner(s);
    for (Result result : scanner) {
      i++;
View Full Code Here

    HTable table = new HTable(conf, userTableName);
    int i = 0;
    Scan s = new Scan();
    FilterList filterList = new FilterList();
    // check for combination of cat in q1 and dog in q1
    Filter filter1 =
        new RowFilter(CompareOp.LESS_OR_EQUAL, new BinaryComparator("row5".getBytes()));
    Filter filter2 = new FirstKeyOnlyFilter();
    filterList.addFilter(filter1);
    filterList.addFilter(filter2);
    s.setFilter(filterList);
    ResultScanner scanner = table.getScanner(s);
    for (Result result : scanner) {
View Full Code Here

    HTable table = put4ColumnIndex();
    int i = 0;
    Scan s = new Scan();
    FilterList filterList = new FilterList();
    // check for combination of cat in q1 and dog in q1
    Filter filter1 =
        new SingleColumnValueFilter("col1".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
            "cat".getBytes());
    Filter filter2 =
        new SingleColumnValueFilter("col2".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
            "dog".getBytes());
    filterList.addFilter(filter1);
    filterList.addFilter(filter2);
    s.setFilter(filterList);
View Full Code Here

  private int countNumberOfRowsWithFilter(String tableName, String filterVal, boolean isIndexed,
      boolean isCached, int cacheNumber) throws IOException {
    Configuration conf = UTIL.getConfiguration();
    HTable table = new HTable(conf, tableName);
    Scan s = new Scan();
    Filter filter = null;
    if (isIndexed) {
      filter =
          new SingleColumnValueFilter("col".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
              filterVal.getBytes());
    } else {
View Full Code Here

    p8.add("col".getBytes(), "ql".getBytes(), "cat".getBytes());
    table.put(p8);

    int i = 0;
    Scan s = new Scan();
    Filter filter = null;
    filter =
        new SingleColumnValueFilter("col".getBytes(), "ql".getBytes(), CompareOp.EQUAL,
            "cat".getBytes());

    s.setFilter(filter);
View Full Code Here

    throws IOException {
    Transaction tx = txCodec.getFromOperation(get);
    if (tx != null) {
      get.setMaxVersions(tx.excludesSize() + 1);
      get.setTimeRange(TxUtils.getOldestVisibleTimestamp(ttlByFamily, tx), TxUtils.getMaxVisibleTimestamp(tx));
      Filter newFilter = Filters.combine(getTransactionFilter(tx), get.getFilter());
      get.setFilter(newFilter);
    }
  }
View Full Code Here

    throws IOException {
    Transaction tx = txCodec.getFromOperation(scan);
    if (tx != null) {
      scan.setMaxVersions(tx.excludesSize() + 1);
      scan.setTimeRange(TxUtils.getOldestVisibleTimestamp(ttlByFamily, tx), TxUtils.getMaxVisibleTimestamp(tx));
      Filter newFilter = Filters.combine(getTransactionFilter(tx), scan.getFilter());
      scan.setFilter(newFilter);
    }
    return s;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.filter.Filter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.