You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Stuart Scott <St...@e-mis.com> on 2011/02/01 15:38:21 UTC

Accessing column information via Thrift/PHP/Scanner

Hi,

 

Wonder if anyone could offer any advice please? I've been working on
this for a few hours and can't suss it out.

Using Thrift through PHP, I can loop down a Hbase table fine. I just
can't pull out the column values associated with the row. The row is
returned correctly but I can't seem to get access to the column data
within the column family array. I've tried various things... my latest
version is below. I've looked in the Hbase wrappers and can't see
anything obvious I'm doing wrong...

 

Any help would be greatly appreciated..

 

$tbl="TEST";

$family = array("FNAMEINFO:TOTAL");
//column family:column

$X=$client->scannerOpen($tbl,"",$family);

while (true )

{

$get_arr = $client->scannerGet($X);

{

if($get_arr == null) break;

  foreach ( $get_arr as $TRowResult )

    {

      $row=$TRowResult->row;

      echo $row;
//returns the row number correctly

      $column = $TRowResult->columns;

      foreach ($column as $family_column=>$Tcell)

       {

        $rec=$Tcell->value;
//doesn't return anything for the column family:column

                echo $rec->value;

       }

    }

  }

}

 

Regards

 

Stuart Scott

System Architect 
emis intellectual technology 
Fulford Grange, Micklefield Lane 
Rawdon Leeds LS19 6BA 
E-mail: stuart.scott@e-mis.com <ma...@e-mis.com>  
Website: www.emisit.com <outbind://26/www.emisit.com>  

Privileged and/or Confidential information may be contained in this
message. If you are not the original addressee indicated in this message
(or responsible for delivery of the message to such person), you may not
copy or deliver this message to anyone. In such case, please delete this
message, and notify us immediately. Opinions, conclusions and other
information expressed in this message are not given or endorsed by EMIS
nor can I conclude contracts on its behalf unless otherwise indicated by
an authorised representative independently of this message. 

EMIS reserves the right to monitor, intercept and (where appropriate)
read all incoming and outgoing communications. By replying to this
message and where necessary you are taken as being aware of and giving
consent to such monitoring, interception and reading.


EMIS is a trading name of Egton Medical Information Systems Limited.
Registered in England. No 2117205. Registered Office: Fulford Grange,
Micklefield Lane, Rawdon, Leeds, LS19 6BA

 


RE: Accessing column information via Thrift/PHP/Scanner

Posted by Stuart Scott <St...@e-mis.com>.
Hi Ryan,

Thanks for the e-mail.
I can see all the data with the shell.
Currently I have all my column family and column names in uppercase (to avoid case sensitive issues).
I can access the information without any problems via my Java project. This is fine. I use Result.getValue(Bytes.toBytes("NAME"),Bytes.toBytes("FIRSTNAME));
It's just the thrift implementation. I can get the column data but I need to know the column-family:column-name . What would be the correct syntax to access a column-family:column-name from a TRowResult? Or can the column-family:column-name be accessed from a TCell some how? Or is it possible to set the order the columns come back in when the scanner is created?

Regards

Stuart



-----Original Message-----
From: Ryan Rawson [mailto:ryanobjc@gmail.com] 
Sent: 01 February 2011 19:49
To: user@hbase.apache.org
Subject: Re: Accessing column information via Thrift/PHP/Scanner

when you scan using the shell what do you see?  Note that qualifier names are just byte[] and thus caps sensitive.

-ryan

On Tue, Feb 1, 2011 at 6:38 AM, Stuart Scott <St...@e-mis.com> wrote:
> Hi,
>
>
>
> Wonder if anyone could offer any advice please? I've been working on 
> this for a few hours and can't suss it out.
>
> Using Thrift through PHP, I can loop down a Hbase table fine. I just 
> can't pull out the column values associated with the row. The row is 
> returned correctly but I can't seem to get access to the column data 
> within the column family array. I've tried various things... my latest 
> version is below. I've looked in the Hbase wrappers and can't see 
> anything obvious I'm doing wrong...
>
>
>
> Any help would be greatly appreciated..
>
>
>
> $tbl="TEST";
>
> $family = array("FNAMEINFO:TOTAL");
> //column family:column
>
> $X=$client->scannerOpen($tbl,"",$family);
>
> while (true )
>
> {
>
> $get_arr = $client->scannerGet($X);
>
> {
>
> if($get_arr == null) break;
>
>  foreach ( $get_arr as $TRowResult )
>
>    {
>
>      $row=$TRowResult->row;
>
>      echo $row;
> //returns the row number correctly
>
>      $column = $TRowResult->columns;
>
>      foreach ($column as $family_column=>$Tcell)
>
>       {
>
>        $rec=$Tcell->value;
> //doesn't return anything for the column family:column
>
>                echo $rec->value;
>
>       }
>
>    }
>
>  }
>
> }
>
>
>
> Regards
>
>
>
> Stuart Scott
>
> System Architect
> emis intellectual technology
> Fulford Grange, Micklefield Lane
> Rawdon Leeds LS19 6BA
> E-mail: stuart.scott@e-mis.com <ma...@e-mis.com>
> Website: www.emisit.com <outbind://26/www.emisit.com>
>
> Privileged and/or Confidential information may be contained in this 
> message. If you are not the original addressee indicated in this 
> message (or responsible for delivery of the message to such person), 
> you may not copy or deliver this message to anyone. In such case, 
> please delete this message, and notify us immediately. Opinions, 
> conclusions and other information expressed in this message are not 
> given or endorsed by EMIS nor can I conclude contracts on its behalf 
> unless otherwise indicated by an authorised representative independently of this message.
>
> EMIS reserves the right to monitor, intercept and (where appropriate) 
> read all incoming and outgoing communications. By replying to this 
> message and where necessary you are taken as being aware of and giving 
> consent to such monitoring, interception and reading.
>
>
> EMIS is a trading name of Egton Medical Information Systems Limited.
> Registered in England. No 2117205. Registered Office: Fulford Grange, 
> Micklefield Lane, Rawdon, Leeds, LS19 6BA
>
>
>
>

Re: Accessing column information via Thrift/PHP/Scanner

Posted by Ryan Rawson <ry...@gmail.com>.
when you scan using the shell what do you see?  Note that qualifier
names are just byte[] and thus caps sensitive.

-ryan

On Tue, Feb 1, 2011 at 6:38 AM, Stuart Scott <St...@e-mis.com> wrote:
> Hi,
>
>
>
> Wonder if anyone could offer any advice please? I've been working on
> this for a few hours and can't suss it out.
>
> Using Thrift through PHP, I can loop down a Hbase table fine. I just
> can't pull out the column values associated with the row. The row is
> returned correctly but I can't seem to get access to the column data
> within the column family array. I've tried various things... my latest
> version is below. I've looked in the Hbase wrappers and can't see
> anything obvious I'm doing wrong...
>
>
>
> Any help would be greatly appreciated..
>
>
>
> $tbl="TEST";
>
> $family = array("FNAMEINFO:TOTAL");
> //column family:column
>
> $X=$client->scannerOpen($tbl,"",$family);
>
> while (true )
>
> {
>
> $get_arr = $client->scannerGet($X);
>
> {
>
> if($get_arr == null) break;
>
>  foreach ( $get_arr as $TRowResult )
>
>    {
>
>      $row=$TRowResult->row;
>
>      echo $row;
> //returns the row number correctly
>
>      $column = $TRowResult->columns;
>
>      foreach ($column as $family_column=>$Tcell)
>
>       {
>
>        $rec=$Tcell->value;
> //doesn't return anything for the column family:column
>
>                echo $rec->value;
>
>       }
>
>    }
>
>  }
>
> }
>
>
>
> Regards
>
>
>
> Stuart Scott
>
> System Architect
> emis intellectual technology
> Fulford Grange, Micklefield Lane
> Rawdon Leeds LS19 6BA
> E-mail: stuart.scott@e-mis.com <ma...@e-mis.com>
> Website: www.emisit.com <outbind://26/www.emisit.com>
>
> Privileged and/or Confidential information may be contained in this
> message. If you are not the original addressee indicated in this message
> (or responsible for delivery of the message to such person), you may not
> copy or deliver this message to anyone. In such case, please delete this
> message, and notify us immediately. Opinions, conclusions and other
> information expressed in this message are not given or endorsed by EMIS
> nor can I conclude contracts on its behalf unless otherwise indicated by
> an authorised representative independently of this message.
>
> EMIS reserves the right to monitor, intercept and (where appropriate)
> read all incoming and outgoing communications. By replying to this
> message and where necessary you are taken as being aware of and giving
> consent to such monitoring, interception and reading.
>
>
> EMIS is a trading name of Egton Medical Information Systems Limited.
> Registered in England. No 2117205. Registered Office: Fulford Grange,
> Micklefield Lane, Rawdon, Leeds, LS19 6BA
>
>
>
>