accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Drew <drewm...@gmail.com>
Subject Bug in Range behavior?
Date Thu, 22 Mar 2012 14:39:33 GMT
I believe I've found a bug (in version 1.3.5)--was going to submit it in
Jira (didn't see anything there that looked like this bug), but couldn't
figure out how to (or if I have permission to).

When I create a Range using the same Key for both the start and end of the
range, they are supposed to both be inclusive.  (BTW, I get the same
behavior when using the alternative Range constructor in which you
explicitly specify inclusive or exclusive end points.)  However, what I
observe is that the key given as the end of the range is NOT included, even
though it is supposed to be.

Here's some code that demonstrates the problem:

        Connector conn = ...;
        String table = "dumb";

        BatchWriter writer = null;
        try {
            long memBuf = 1000000L; // bytes to store before sending a batch
            long timeout = 100L; // milliseconds to wait before sending
            int numThreads = 10;
            writer = conn.createBatchWriter(table, memBuf, timeout,
numThreads);

            Mutation mutation = createMutation("row", "colFam", "colQual",
"value");
            writer.addMutation(mutation);

        } finally {
            if (writer != null) writer.close();
        }

        Scanner scanner = conn.createScanner(table, new Authorizations());
        Key k = new Key("row", "colFam", "colQual");

        System.out.println("\nbounded on both ends");
        scanner.setRange(new Range(k,k));
        for (Entry<Key, Value> entry : scanner) {
            System.out.println("  entry = " + entry);
        }

        System.out.println("\nbounded below");
        scanner.setRange(new Range(k,null));
        for (Entry<Key, Value> entry : scanner) {
            System.out.println("  entry = " + entry);
        }

        System.out.println("\nbounded above");
        scanner.setRange(new Range(null,k));
        for (Entry<Key, Value> entry : scanner) {
            System.out.println("  entry = " + entry);
        }

        System.out.println("\nDone!");

This code produces:

bounded on both ends

bounded below
  entry = row colFam:colQual [] 1332426309764 false value

bounded above

Done!

--Mark

Mime
View raw message