Package org.apache.hadoop.hbase.filter

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


    HTable table = new HTable(conf, "testtable");

    // vv ValueFilterExample
    Filter filter = new ValueFilter(CompareFilter.CompareOp.EQUAL, // co ValueFilterExample-1-Filter Create filter, while specifying the comparison operator and comparator.
      new SubstringComparator(".4"));

    Scan scan = new Scan();
    scan.setFilter(filter); // co ValueFilterExample-2-SetFilter Set filter for the scan.
    ResultScanner scanner = table.getScanner(scan);
    // ^^ ValueFilterExample
View Full Code Here


      System.out.println(res);
    }
    scanner2.close();

    Filter filter3 = new RowFilter(CompareFilter.CompareOp.EQUAL, // co RowFilterExample-3-Filter3 The third filter uses a substring match approach.
      new SubstringComparator("-5"));
    scan.setFilter(filter3);
    ResultScanner scanner3 = table.getScanner(scan);
    // ^^ RowFilterExample
    System.out.println("Scanning table #3...");
    // vv RowFilterExample
View Full Code Here

           
            if (mailboxPath.getUser() != null) {
                SingleColumnValueFilter userFilter = new SingleColumnValueFilter(MAILBOX_CF, MAILBOX_USER, CompareOp.EQUAL, Bytes.toBytes(mailboxPath.getUser()));
                filters.addFilter(userFilter);
            }
            SubstringComparator pathComparator;
            String mboxName = mailboxPath.getName();
            /*
             * TODO: use a RegExFiler
             */
            if (mboxName.length() >= 1) {
                if (mboxName.charAt(mboxName.length() - 1) == '%') {
                    mboxName = mboxName.substring(0, mboxName.length() - 1);
                }
            }
            if (mboxName.length() >= 1) {
                if (mboxName.charAt(0) == '%') {
                    mboxName = mboxName.substring(1);
                }
            }
            pathComparator = new SubstringComparator(mboxName);
            SingleColumnValueFilter nameFilter = new SingleColumnValueFilter(MAILBOX_CF, MAILBOX_NAME, CompareOp.EQUAL, pathComparator);
            filters.addFilter(nameFilter);
            SingleColumnValueFilter namespaceFilter = new SingleColumnValueFilter(MAILBOX_CF, MAILBOX_NAMESPACE, CompareOp.EQUAL, Bytes.toBytes(mailboxPath.getNamespace()));
            filters.addFilter(namespaceFilter);
           
View Full Code Here

TOP

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

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.