accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Billie Rinaldi <billie.rina...@gmail.com>
Subject Re: using Range.prefix
Date Tue, 03 May 2016 14:12:27 GMT
On Tue, May 3, 2016 at 6:55 AM, z11373 <z11373@outlook.com> wrote:

> Hi,
> I have a table that contains following rows:
>
> 20160421_a484869 cf: [public]
> 20160421_f109973 cf: [public]
>
> And I have following code:
>
>                 Authorizations publicAuthz = new Authorizations("public");
>                 Scanner scanner = connector.createScanner(TABLE,
> publicAuthz);
>                 Text rowPrefix = new Text("20160421");
>                 Range range = Range.prefix(rowPrefix, new Text("cf"));
>

This usage of Range.prefix will find all the column families beginning with
"cf" in the "20160421" row.  To find rows with the given prefix, use
Range.prefix(rowPrefix).  You can add scanner.fetchColumnFamily to specify
which column family to fetch.


>                 scanner.setRange(range);
>                 for (Entry<Key, Value> entry : scanner) {
>                         String key = entry.getKey().toString();
>                         System.out.println(key);
>                 }
>
>
> The loop is not entered, which is unexpected to me. If I comment the
> setRange code, then it'll print out both row ids. Can you tell me what I
> missed here?
>
> Thanks,
> Z
>
>
>
> --
> View this message in context:
> http://apache-accumulo.1065345.n5.nabble.com/using-Range-prefix-tp16835.html
> Sent from the Developers mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message