You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hadoop.apache.org by Narlin M <hp...@gmail.com> on 2013/08/09 21:08:35 UTC

Hadoop-HBase table hierarchical column scan

I am fairly new to the hadoop-hbase environment having started working on
it very recently, so I hope I am wording the question correctly.

I am trying to read data from a hadoop-hbase table which has only one
column family named 'DFLT'. This family contains hierarchical column
qualifiers "/source:int64/name:string". I want to read the name column for
a particular source value, say 10. How can I achieve this using the Scan
class?

I tried setting up the scan object as follows:

...

byte[] family = Bytes.toBytes("DFLT");
byte[] qualifier = Bytes.toBytes("source:name");

Scan scan = new Scan();
scan.addFamily(family, qualifier);

FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);

SingleColumnValueFilter filter = new SingleColumnValueFilter(family,
Bytes.toBytes("source"), CompareFilter.CompareOp.EQUAL, Bytes.toBytes(10));

list.addFilter(filter);

scan.setFilter(list);

...


But I do not get any data back with this setup. I am guessing that I am not
setting up the hierarchical qualifiers correctly. Any and all pointers will
be appreciated.

Thanks, Narlin M.

Re: Hadoop-HBase table hierarchical column scan

Posted by Narlin M <hp...@gmail.com>.
Correction: Its scan.addColumn(family, qualifier) and not
scan.addFamily(family,
qualifier) that I actually used.

Thanks, Narlin M.


On Fri, Aug 9, 2013 at 2:08 PM, Narlin M <hp...@gmail.com> wrote:

> I am fairly new to the hadoop-hbase environment having started working on
> it very recently, so I hope I am wording the question correctly.
>
> I am trying to read data from a hadoop-hbase table which has only one
> column family named 'DFLT'. This family contains hierarchical column
> qualifiers "/source:int64/name:string". I want to read the name column for
> a particular source value, say 10. How can I achieve this using the Scan
> class?
>
> I tried setting up the scan object as follows:
>
> ...
>
> byte[] family = Bytes.toBytes("DFLT");
> byte[] qualifier = Bytes.toBytes("source:name");
>
> Scan scan = new Scan();
> scan.addFamily(family, qualifier);
>
> FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
>
> SingleColumnValueFilter filter = new SingleColumnValueFilter(family,
> Bytes.toBytes("source"), CompareFilter.CompareOp.EQUAL, Bytes.toBytes(10)
> );
>
> list.addFilter(filter);
>
> scan.setFilter(list);
>
> ...
>
>
> But I do not get any data back with this setup. I am guessing that I am
> not setting up the hierarchical qualifiers correctly. Any and all pointers
> will be appreciated.
>
> Thanks, Narlin M.
>

Re: Hadoop-HBase table hierarchical column scan

Posted by Narlin M <hp...@gmail.com>.
Correction: Its scan.addColumn(family, qualifier) and not
scan.addFamily(family,
qualifier) that I actually used.

Thanks, Narlin M.


On Fri, Aug 9, 2013 at 2:08 PM, Narlin M <hp...@gmail.com> wrote:

> I am fairly new to the hadoop-hbase environment having started working on
> it very recently, so I hope I am wording the question correctly.
>
> I am trying to read data from a hadoop-hbase table which has only one
> column family named 'DFLT'. This family contains hierarchical column
> qualifiers "/source:int64/name:string". I want to read the name column for
> a particular source value, say 10. How can I achieve this using the Scan
> class?
>
> I tried setting up the scan object as follows:
>
> ...
>
> byte[] family = Bytes.toBytes("DFLT");
> byte[] qualifier = Bytes.toBytes("source:name");
>
> Scan scan = new Scan();
> scan.addFamily(family, qualifier);
>
> FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
>
> SingleColumnValueFilter filter = new SingleColumnValueFilter(family,
> Bytes.toBytes("source"), CompareFilter.CompareOp.EQUAL, Bytes.toBytes(10)
> );
>
> list.addFilter(filter);
>
> scan.setFilter(list);
>
> ...
>
>
> But I do not get any data back with this setup. I am guessing that I am
> not setting up the hierarchical qualifiers correctly. Any and all pointers
> will be appreciated.
>
> Thanks, Narlin M.
>

Re: Hadoop-HBase table hierarchical column scan

Posted by Narlin M <hp...@gmail.com>.
Correction: Its scan.addColumn(family, qualifier) and not
scan.addFamily(family,
qualifier) that I actually used.

Thanks, Narlin M.


On Fri, Aug 9, 2013 at 2:08 PM, Narlin M <hp...@gmail.com> wrote:

> I am fairly new to the hadoop-hbase environment having started working on
> it very recently, so I hope I am wording the question correctly.
>
> I am trying to read data from a hadoop-hbase table which has only one
> column family named 'DFLT'. This family contains hierarchical column
> qualifiers "/source:int64/name:string". I want to read the name column for
> a particular source value, say 10. How can I achieve this using the Scan
> class?
>
> I tried setting up the scan object as follows:
>
> ...
>
> byte[] family = Bytes.toBytes("DFLT");
> byte[] qualifier = Bytes.toBytes("source:name");
>
> Scan scan = new Scan();
> scan.addFamily(family, qualifier);
>
> FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
>
> SingleColumnValueFilter filter = new SingleColumnValueFilter(family,
> Bytes.toBytes("source"), CompareFilter.CompareOp.EQUAL, Bytes.toBytes(10)
> );
>
> list.addFilter(filter);
>
> scan.setFilter(list);
>
> ...
>
>
> But I do not get any data back with this setup. I am guessing that I am
> not setting up the hierarchical qualifiers correctly. Any and all pointers
> will be appreciated.
>
> Thanks, Narlin M.
>

Re: Hadoop-HBase table hierarchical column scan

Posted by Narlin M <hp...@gmail.com>.
Correction: Its scan.addColumn(family, qualifier) and not
scan.addFamily(family,
qualifier) that I actually used.

Thanks, Narlin M.


On Fri, Aug 9, 2013 at 2:08 PM, Narlin M <hp...@gmail.com> wrote:

> I am fairly new to the hadoop-hbase environment having started working on
> it very recently, so I hope I am wording the question correctly.
>
> I am trying to read data from a hadoop-hbase table which has only one
> column family named 'DFLT'. This family contains hierarchical column
> qualifiers "/source:int64/name:string". I want to read the name column for
> a particular source value, say 10. How can I achieve this using the Scan
> class?
>
> I tried setting up the scan object as follows:
>
> ...
>
> byte[] family = Bytes.toBytes("DFLT");
> byte[] qualifier = Bytes.toBytes("source:name");
>
> Scan scan = new Scan();
> scan.addFamily(family, qualifier);
>
> FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
>
> SingleColumnValueFilter filter = new SingleColumnValueFilter(family,
> Bytes.toBytes("source"), CompareFilter.CompareOp.EQUAL, Bytes.toBytes(10)
> );
>
> list.addFilter(filter);
>
> scan.setFilter(list);
>
> ...
>
>
> But I do not get any data back with this setup. I am guessing that I am
> not setting up the hierarchical qualifiers correctly. Any and all pointers
> will be appreciated.
>
> Thanks, Narlin M.
>