Java Code Examples for org.apache.hadoop.hbase.filter.Filter#setReversed()

The following examples show how to use org.apache.hadoop.hbase.filter.Filter#setReversed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DistinctPrefixFilterTest.java    From phoenix with Apache License 2.0 6 votes vote down vote up
public void testSingleFixedWidth() throws Exception {
    Filter f = createFilter(new int[]{3}, 1);
    assertInclude("000", f);
    assertInclude("001", f);
    assertSeekAndHint("001", f, "002");
    assertInclude("003", f);
    assertInclude("004", f);
    assertInclude("005", f);
    assertSeekAndHint("005", f, "006");

    f = createFilter(new int[]{3}, 1);
    f.setReversed(true);
    assertInclude("005", f);
    assertInclude("004", f);
    assertSeekAndHint(new byte[]{'0','0','4'}, f, new byte[]{'0','0','4'}, false);
    assertInclude("003", f);
    assertInclude("002", f);
    assertInclude("001", f);
    assertSeekAndHint(new byte[]{'0','0','1'}, f, new byte[]{'0','0','1'}, false);
}
 
Example 2
Source File: DistinctPrefixFilterTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
public void testMultiFixedWidth() throws Exception {
    Filter f = createFilter(new int[]{5,4}, 1);
    assertInclude("00000aaaa", f);
    assertInclude("00001aaaa", f);
    assertSeekAndHint("00001aaaa", f, "00002");
    assertInclude("00003aaaa", f);
    assertInclude("00004aaaa", f);
    assertInclude("00005aaaa", f);
    assertSeekAndHint("00005aaaa", f, "00006");

    f = createFilter(new int[]{5,4}, 2);
    assertInclude("00000aaaa", f);
    assertInclude("00001aaaa", f);
    assertSeekAndHint("00001aaaa", f, "00001aaab");
    assertInclude("00003aaaa", f);
    assertInclude("00004aaaa", f);
    assertInclude("00005aaaa", f);
    assertSeekAndHint("00005aaaa", f, "00005aaab");

    f = createFilter(new int[]{3,2}, 1);
    f.setReversed(true);
    assertInclude("005aa", f);
    assertInclude("004aa", f);
    assertSeekAndHint(new byte[]{'0','0','4','a','a'}, f, new byte[]{'0','0','4'}, false);
    assertInclude("003aa", f);
    assertInclude("002aa", f);
    assertInclude("001aa", f);
    assertSeekAndHint(new byte[]{'0','0','1','a','a'}, f, new byte[]{'0','0','1'}, false);

    f = createFilter(new int[]{3,2}, 2);
    f.setReversed(true);
    assertInclude("005bb", f);
    assertInclude("004bb", f);
    assertInclude("003bb", f);
    assertSeekAndHint(new byte[]{'0','0','3','b','b'}, f, new byte[]{'0','0','3','b','b'}, false);
    assertInclude("003ba", f);
    assertInclude("002bb", f);
    assertInclude("001bb", f);
    assertSeekAndHint(new byte[]{'0','0','1','b','b'}, f, new byte[]{'0','0','1','b','b'}, false);
}
 
Example 3
Source File: DistinctPrefixFilterTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
public void testMultiVariableWidth() throws Exception {
    Filter f = createFilter(new int[]{-5,-4}, 1);
    assertInclude("00000\00aaaa", f);
    assertInclude("00001\00aaaa", f);
    assertSeekAndHint("00001\00aaaa", f, "00001\01");
    assertInclude("00003\00aaaa", f);
    assertInclude("00004\00aaaa", f);
    assertInclude("00005\00aaaa", f);
    assertSeekAndHint("00005\00aaaa", f, "00005\01");

    f = createFilter(new int[]{-5,-4}, 2);
    assertInclude("00000\00aaaa", f);
    assertInclude("00001\00aaaa", f);
    assertSeekAndHint("00001\00aaaa", f, "00001\00aaaa\01");
    assertInclude("00003\00aaaa", f);
    assertInclude("00004\00aaaa", f);
    assertInclude("00005\00aaaa", f);
    assertSeekAndHint("00005\00aaaa", f, "00005\00aaaa\01");

    f = createFilter(new int[]{-3,-2}, 1);
    f.setReversed(true);
    assertInclude("005\00aa", f);
    assertInclude("004\00aa", f);
    assertSeekAndHint(new byte[]{'0','0','4', 0, 'a', 'a'}, f,
            new byte[] {'0','0','4'}, false);

    f = createFilter(new int[]{-3,-2}, 2);
    f.setReversed(true);
    assertInclude("005\00bb", f);
    assertInclude("004\00bb", f);
    assertSeekAndHint(new byte[]{'0','0','4', 0, 'b', 'b'}, f,
            new byte[]{'0','0','4', 0, 'b', 'b'}, false); 
}
 
Example 4
Source File: DistinctPrefixFilterTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
public void testNoNextKey() throws Exception {
    Filter f = createFilter(new int[]{2,2}, 1);
    assertInclude("00cc", f);
    assertInclude(new byte[]{-1,-1,20,20}, f);
    // make sure we end the scan when we cannot increase a fixed length prefix
    assertSeekAndHint(new byte[]{-1,-1,20,20}, f, new byte[]{-1,-1}, true);
    assertSeekAndHint(new byte[]{-1,-1,20,20}, f, new byte[]{-1,-1}, true);

    f = createFilter(new int[]{2,2}, 1);
    f.setReversed(true);
    assertInclude(new byte[]{0,0,1,1}, f);
    assertSeekAndHint(new byte[]{0,0,1,1}, f, new byte[]{0,0}, false);
    assertSeekAndHint(new byte[]{0,0,1,1}, f, new byte[]{0,0}, false);
}