hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weichao <nnever...@gmail.com>
Subject Re: row filter - binary comparator at certain range
Date Fri, 10 Feb 2012 10:01:39 GMT
just use
*Bytes.toBytes(System.currentTimeMillis())* or some like *Bytes.toBytes(new
Date(someTime).getTime())* as rowkeys(you can even append some other datas
before or after the time)

when u seach, just use
*scan.setStartRow(Bytes.toBytes(new Date("specifie start-time").getTime()));
*
*scan.setEndRow(Bytes.toBytes(new Date("specifie end-time").getTime())); *
*then u may get what u want...*
or am I misunderstand you?

2012/2/10 Alex Vasilenko <aa.vasilenko@gmail.com>

> Let me rephrase my question a bit: what common pattern of row key for
> time-series data?  OpenTSDB schema is a common reference, but it's limited
> to per-metric time-series data.
>
> Regards,
> Alex
>
> 2012/2/9 Alex Vasilenko <aa.vasilenko@gmail.com>
>
> > Ted,
> >
> > Scan#setTimeRange filters columns, not rows, I think it's not optimal,
> > because all rows, including columns will be read. In case of
> > BinaryRangeComparator rows not in range will be filtered out earlier.
> >
> > Thanks,
> > Alexandr Vasilenko
> >
> >
> > 2012/2/9 Ted Yu <yuzhihong@gmail.com>
> >
> >> Alex:
> >> Does the timestamp below reflect actual time ?
> >> If so, take a look at the following method (and its javadoc) in
> Scan.java:
> >>  public Scan setTimeRange(long minStamp, long maxStamp)
> >>
> >> Cheers
> >>
> >> On Thu, Feb 9, 2012 at 11:08 AM, Alex Vasilenko <aa.vasilenko@gmail.com
> >> >wrote:
> >>
> >> > Lars,
> >> >
> >> > But how it will behave, when I have salt at the beginning of the key
> to
> >> > properly shard table across regions? Imagine row key of format
> >> > salt:timestamp and rows goes like this:
> >> > ...
> >> > 1:15
> >> > 1:16
> >> > 1:17
> >> > 1:23
> >> > 2:3
> >> > 2:5
> >> > 2:12
> >> > 2:15
> >> > 2:19
> >> > 2:25
> >> > ...
> >> >
> >> > And I want to find all rows, that has second part (timestamp) in range
> >> > 15-25. What startKey and endKey should be used?
> >> >
> >> > Alexandr Vasilenko
> >> > Web Developer
> >> > Skype:menterr
> >> > mob: +38097-611-45-99
> >> >
> >> >
> >> > 2012/2/9 lars hofhansl <lhofhansl@yahoo.com>
> >> >
> >> > > Sorry misunderstood your question.
> >> > >
> >> > > In that case you'd just use a scanner (see Scan.java) and set that
> >> > > startKey and the endKey.
> >> > > That will give you that range of keys and it do so efficiently, as
> it
> >> can
> >> > > seek forward to the startKey.
> >> > >
> >> > > -- Lars
> >> > >
> >> > >
> >> > >
> >> > > ________________________________
> >> > >  From: Alex Vasilenko <aa.vasilenko@gmail.com>
> >> > > To: user@hbase.apache.org
> >> > > Sent: Thursday, February 9, 2012 10:40 AM
> >> > > Subject: Re: row filter - binary comparator at certain range
> >> > >
> >> > > Lars,
> >> > >
> >> > > I meant range of row keys. BinaryPrefixComparator can be used in
> >> > > conjunction with RowFilter to filter by prefix.
> >> > >
> >> > > Alex
> >> > >
> >> > > 2012/2/9 lars hofhansl <lhofhansl@yahoo.com>
> >> > >
> >> > > > Note the BinaryPrefixComparator compares values (not keys).
> >> > > > Not sure that this is what you want, but you mention a "range
of
> >> key".
> >> > > >
> >> > > >
> >> > > > For keys there are ColumnPrefixFilter and ColumnRangeFilter.
> >> > > >
> >> > > >
> >> > > > -- Lars
> >> > > >
> >> > > >
> >> > > >
> >> > > > ________________________________
> >> > > >  From: Alex Vasilenko <aa.vasilenko@gmail.com>
> >> > > > To: user@hbase.apache.org
> >> > > > Sent: Thursday, February 9, 2012 10:03 AM
> >> > > > Subject: row filter - binary comparator at certain range
> >> > > >
> >> > > > Hi all,
> >> > > >
> >> > > > I'm a brand new user of hbase and hadoop in general. Trying to
> >> evaluate
> >> > > > hbase for our needs. Question is: why there's
> >> BinaryPrefixComparator,
> >> > but
> >> > > > no BinaryRangeComparator, where you specify what range of key
> >> should be
> >> > > > compared. Are there any concerns about using it?
> >> > > >
> >> > > > Thanks,
> >> > > > Alexandr Vasilenko
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>

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