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:25:04 GMT
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