accumulo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William Slacum <>
Subject Re: querying for relevant rows
Date Fri, 29 Jun 2012 18:50:26 GMT
You can use a BatchScanner and give it two ranges. It would look something

ArrayList<Range> ranges = new ArrayList<Range();
ranges.add(new Range(new Key(timestamp1)));
ranges.add(new Range(new Key(timestamp2)));

BatchScanner bs = con.createBatchScanner(...);

//set  your iterators and filters


for(Entry<Key, Value> e : bs) {
  //your stuff

On Fri, Jun 29, 2012 at 11:19 AM, Lam <> wrote:

> I'm using a timestamp as a key and the value is all the relevant data
> starting at that timestamp up to the timestamp represented by the key
> of the next row.
> When querying, I'm given a time span, consisting of a start and stop
> time.  I want to return all the relevant data within the time span, so
> I was to retrieve the appropriate rows (then filter the data for the
> given timespan).
> Example:
> In Accumulo:  (the format of the value is  <letter>.<timestamp>)
>     key=1  value= {a.1 b.1 c.2 d.2}
>     key=3  value= {m.3 n.4 o.5}
>     key=6  value={x.6 y.6 z.7}
> Query:  timespan=[2 4]  (get all data from timestamp 2 to 4 inclusively)
> Desire result: retrieve key=1 and key=3, then filter out a.1, b.1, and
> o.5, and return the rest
> Problem: How do I know to retrieve key=1 and key=3 without scanning
> all the keys?
> Can I create a scanner that looks for the given start key=2 and go to
> the prior row (i.e. key=1)?
> --
> D. Lam

View raw message