Question

I'm using HBase 0.98 which allows scans in reverse order.

Here is my code:

    scan = new Scan(eventTimeKey, nowKey);
    scan.setCaching(1); // setting this to 1 since I only want the first result
    scan.setMaxResultSize(1L);
    scan.addColumn(dataBytes, readingBytes);
    scan.setReversed(true);
    try {
        scanner = getTable().getScanner(scan);
        result = scanner.next();
    } finally {
        if (scanner != null)
            scanner.close();
    }
    if (result != null && valueIsZero(result))
        return true;

My question is, what order should the arguments to the Scan constructor be in? Should startKey be 'aaa' and endKey be 'zzz' or the other way around? Or does it matter?

Update: turns out, we have HBase 0.96 on the server side so reverse scans are, apparently, not going to work. I think this explains the confusion I was having. Until we upgrade, my tests are not going to be able to answer this question so I'll leave this open in case someone else is interested.

Was it helpful?

Solution

In case of reversed scan in HBase 0.98 onwards start key and end key are reversed.

Documentation Link explains this: Doc Link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top