You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Zebra Zhao <ze...@gmail.com> on 2011/11/26 05:56:48 UTC
How to retrieve qualifier information from TRowResult in Thrift(v0.80) Hbase(v0.90) Php
Hi All,
I created a Hbase table with following schema:
<row_id> --> {<cf_id>: [<qualifier_id1>,<qualifier_id2>,...]}
Row record sample:
<"00001"> {<"cf_01">:<"qualifier_01">,<"qualifier_02">,...]}
I wrote following code to retrieve the all the qualifier name associated
with one TRowResult. Here is the code:
$rowKey = "00001";
$rowResults = $client->getRow($tableName,$rowKey);
foreach ($rowResults as $rowresult){
if ($rowresult->row){
echo( "row: {$rowresult->row}, cols: \n" );
$values = $rowresult->columns;
asort( $values );
foreach ( $values as $k=>$v ) {
echo( " {$k} => {$v->value}\n" );
}//foreach
}//if
}//foreach
However, the output didnot show any qualifier name:
row: 00001, cols:
cf_01 =>
My question is how to retrieve the qualifier information from a TRowResult.
Specifically, how to get "qualifier_01","qualifier_02" using above code.
I've looked up the Hbase.php Hbase_type.php, but did not find the useful
information.
Any suggestion will be appreciated.
Thank you,
Zhao
Re: How to retrieve qualifier information from TRowResult in Thrift(v0.80) Hbase(v0.90) Php
Posted by Jean-Daniel Cryans <jd...@apache.org>.
This looks like the right way to do it, are you sure you are using the
qualifiers correctly?
J-D
On Fri, Nov 25, 2011 at 8:56 PM, Zebra Zhao <ze...@gmail.com> wrote:
> Hi All,
>
> I created a Hbase table with following schema:
> <row_id> --> {<cf_id>: [<qualifier_id1>,<qualifier_id2>,...]}
> Row record sample:
> <"00001"> {<"cf_01">:<"qualifier_01">,<"qualifier_02">,...]}
> I wrote following code to retrieve the all the qualifier name associated
> with one TRowResult. Here is the code:
> $rowKey = "00001";
> $rowResults = $client->getRow($tableName,$rowKey);
> foreach ($rowResults as $rowresult){
> if ($rowresult->row){
> echo( "row: {$rowresult->row}, cols: \n" );
> $values = $rowresult->columns;
> asort( $values );
> foreach ( $values as $k=>$v ) {
> echo( " {$k} => {$v->value}\n" );
> }//foreach
> }//if
> }//foreach
>
> However, the output didnot show any qualifier name:
> row: 00001, cols:
> cf_01 =>
>
> My question is how to retrieve the qualifier information from a TRowResult.
> Specifically, how to get "qualifier_01","qualifier_02" using above code.
> I've looked up the Hbase.php Hbase_type.php, but did not find the useful
> information.
> Any suggestion will be appreciated.
>
> Thank you,
> Zhao