hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajeshkumar J <rajeshkumarit8...@gmail.com>
Subject Re: Getting all the columns of row-key at once
Date Fri, 22 Jan 2016 05:41:56 GMT
If that is the case if I do maintain only one versions of my data is this
retrieval is possible?

Thanks

On Fri, Jan 22, 2016 at 11:01 AM, ramkrishna vasudevan <
ramkrishna.s.vasudevan@gmail.com> wrote:

> Currently that is not possible. The reason being that the columns are not
> fixed in HBase.
> There could be another row or may another version of this row 100 where
> there are only col2 and col4 populated and there is no col1 and col3.
> So as per your schema you should be knowing with which column the value is
> associated.
> In other words
>
> Row-key         col1            col2             col3            col4
>
> 100               xxx                yyy             zzz            aaa
> 100                                   xxx                              yyy
>
> Now how do you know xxx is associated with col2 or col1 when you try to
> retrieve the latest version of row key 100?
>
> Regards
> Ram
>
>
> On Fri, Jan 22, 2016 at 10:55 AM, Rajeshkumar J <
> rajeshkumarit8292@gmail.com
> > wrote:
>
> > Hi,
> >
> >   For instance
> >
> > Row-key         col1            col2             col3            col4
> >
> > 100               xxx                yyy             zzz            aaa
> >
> > I am scanning this row-key(100) and I want to get the value as
> > xxx,yyy,zzz,aaa from Result instance. Not using iterator to get xxxx then
> > yyyy then zzzz then aaaa.
> >
> > Thanks
> >
> > On Fri, Jan 22, 2016 at 10:47 AM, ramkrishna vasudevan <
> > ramkrishna.s.vasudevan@gmail.com> wrote:
> >
> > > Once you retrieve a result it will have all the columns that were
> > scanned.
> > > If suppose you had 5 columns and you specifically wanted only 2 columns
> > out
> > > of it you can add the required columns using scan.addColumn() API then
> > the
> > > result will have only those 2 columns.
> > > If nothing is specified your result will have entire set of columns
> that
> > > comprises that row (including multiple Column families).
> > >
> > > But every column's result is an individual KeyValue which you may have
> to
> > > iterate and get it.
> > > >> So is there any option to get all the column
> > > values of row-key at once.
> > > So this is already happening for you.  Am I missing something here?
> > >
> > > On Fri, Jan 22, 2016 at 10:31 AM, Rajeshkumar J <
> > > rajeshkumarit8292@gmail.com
> > > > wrote:
> > >
> > > > Hi,
> > > >
> > > >   I have already posted this in mailing list but with changes in my
> use
> > > > case.  Is there any options to retrieve all the columns of row-key at
> > > once.
> > > >
> > > > ResultScanner resultScanner = table.getScanner(scan);
> > > >         Iterator<Result> iterator = resultScanner.iterator();
> > > >         while (iterator.hasNext()) {
> > > >          Result next = iterator.next();
> > > > for (KeyValue key : next.list()) {
> > > >
> > > >          System.out.println(Bytes.toString(key.getValue()));
> > > > }
> > > >
> > > >
> > > >
> > > > This  is how I am doing scan using java api. Using this I can get
> only
> > > one
> > > > columns in each iteration. So is there any option to get all the
> column
> > > > values of row-key at once.
> > > >
> > > > Thanks
> > > >
> > >
> >
>

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