You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Gary Richardson <ga...@gmail.com> on 2009/02/23 19:11:19 UTC

PHP - fb303_types.php

Hi,

I'm trying to work with the PHP thrift api and I've hit a stumbling block.

My script looks like:

#!/usr/bin/php
> <?php
>
> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
>
> require_once $GLOBALS['THRIFT_ROOT'] .
> 'packages/hive_service/ThriftHive.php';
>

And I'm getting the following error when I try to run it:

PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php):
failed to open stream: No such file or directory in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php
on line 9
PHP Warning:  include_once(): Failed opening
'thriftroot//packages/fb303/fb303_types.php' for inclusion
(include_path='.:/usr/share/pear:/usr/share/php') in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php
on line 9
PHP Warning:
include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php):
failed to open stream: No such file or directory in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php
on line 10
PHP Warning:  include_once(): Failed opening
'thriftroot//packages/hive_metastore/hive_metastore_types.php' for inclusion
(include_path='.:/usr/share/pear:/usr/share/php') in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php
on line 10
PHP Warning:
include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php):
failed to open stream: No such file or directory in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
on line 10
PHP Warning:  include_once(): Failed opening
'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for inclusion
(include_path='.:/usr/share/pear:/usr/share/php') in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
on line 10
PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
on line 12

I found FacebookBase.php, but my searching/googling hasn't revealed a
fb303_types.php. My packages directory looks like:

[root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
thriftroot/packages/hive_service/ThriftHive.php
thriftroot/packages/hive_service/hive_service_types.php
thriftroot/packages/fb303/FacebookBase.php

Is there a package somewhere that has the fb303 thrift code in it? Do I need
to build it myself?

Thanks!

RE: PHP - fb303_types.php

Posted by Stephen Corona <sc...@adknowledge.com>.
Oh, sorry.. The first link is fb303_types.php and the second link is reflection_limited_types.php

Steve Corona
________________________________________
From: Stephen Corona [scorona@adknowledge.com]
Sent: Monday, February 23, 2009 1:27 PM
To: hive-user@hadoop.apache.org
Subject: RE: PHP - fb303_types.php

I have these in my project, not sure where they came from..

THRIFT_ROOT/packages/fb303

http://pastebin.com/f1ecb38aa

THRIFT_ROOT/packages/reflection_limited

http://pastebin.com/d6658b538

Steve Corona

________________________________________
From: Gary Richardson [gary.richardson@gmail.com]
Sent: Monday, February 23, 2009 1:11 PM
To: hive-user@hadoop.apache.org
Subject: PHP - fb303_types.php

Hi,

I'm trying to work with the PHP thrift api and I've hit a stumbling block.

My script looks like:

#!/usr/bin/php
<?php

$GLOBALS['THRIFT_ROOT'] = 'thriftroot/';

require_once $GLOBALS['THRIFT_ROOT'] . 'packages/hive_service/ThriftHive.php';

And I'm getting the following error when I try to run it:

PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php): failed to open stream: No such file or directory in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 9
PHP Warning:  include_once(): Failed opening 'thriftroot//packages/fb303/fb303_types.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 9
PHP Warning:  include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php): failed to open stream: No such file or directory in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 10
PHP Warning:  include_once(): Failed opening 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 10
PHP Warning:  include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php): failed to open stream: No such file or directory in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php on line 10
PHP Warning:  include_once(): Failed opening 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php on line 10
PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php on line 12
I found FacebookBase.php, but my searching/googling hasn't revealed a fb303_types.php. My packages directory looks like:

[root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
thriftroot/packages/hive_service/ThriftHive.php
thriftroot/packages/hive_service/hive_service_types.php
thriftroot/packages/fb303/FacebookBase.php

Is there a package somewhere that has the fb303 thrift code in it? Do I need to build it myself?

Thanks!

RE: PHP - fb303_types.php

Posted by Stephen Corona <sc...@adknowledge.com>.
I have these in my project, not sure where they came from..

THRIFT_ROOT/packages/fb303

http://pastebin.com/f1ecb38aa

THRIFT_ROOT/packages/reflection_limited

http://pastebin.com/d6658b538

Steve Corona

________________________________________
From: Gary Richardson [gary.richardson@gmail.com]
Sent: Monday, February 23, 2009 1:11 PM
To: hive-user@hadoop.apache.org
Subject: PHP - fb303_types.php

Hi,

I'm trying to work with the PHP thrift api and I've hit a stumbling block.

My script looks like:

#!/usr/bin/php
<?php

$GLOBALS['THRIFT_ROOT'] = 'thriftroot/';

require_once $GLOBALS['THRIFT_ROOT'] . 'packages/hive_service/ThriftHive.php';

And I'm getting the following error when I try to run it:

PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php): failed to open stream: No such file or directory in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 9
PHP Warning:  include_once(): Failed opening 'thriftroot//packages/fb303/fb303_types.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 9
PHP Warning:  include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php): failed to open stream: No such file or directory in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 10
PHP Warning:  include_once(): Failed opening 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_types.php on line 10
PHP Warning:  include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php): failed to open stream: No such file or directory in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php on line 10
PHP Warning:  include_once(): Failed opening 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php on line 10
PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php on line 12
I found FacebookBase.php, but my searching/googling hasn't revealed a fb303_types.php. My packages directory looks like:

[root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
thriftroot/packages/hive_service/ThriftHive.php
thriftroot/packages/hive_service/hive_service_types.php
thriftroot/packages/fb303/FacebookBase.php

Is there a package somewhere that has the fb303 thrift code in it? Do I need to build it myself?

Thanks!

Re: PHP - fb303_types.php

Posted by Raghu Murthy <ra...@facebook.com>.
This is great! Can you provide a patch to the jira
https://issues.apache.org/jira/browse/HIVE-299? :)

Regarding changing thrift, you can create a jira at:
http://issues.apache.org/jira/browse/THRIFT
And provide a patch there as well!

raghu

On 2/23/09 2:58 PM, "Gary Richardson" <ga...@gmail.com> wrote:

> Hey guys,
> 
> I've pretty much got everything working now with my php setup. Thanks for all
> the help. I plan on putting a summary of how to get PHP talking to Hive at
> some point soon.
> 
> I did run into one problem with reading results. The TSocket readAll() method
> would throw a timeout exception. Commenting out those exceptions made the code
> work. I dug a bit deeper and it looks the socket has timed_out == true while
> it's blocking (blocked === true). I patched my copy to get it going:
> 
> @@ -213,7 +213,7 @@
>      $pre = null;
>      while (TRUE) {
>        $buf = @fread($this->handle_, $len);
> -      if ($buf === FALSE || $buf === '') {
> +      if ($buf === FALSE) {
>          $md = stream_get_meta_data($this->handle_);
>          if ($md['timed_out']) {
>            throw new TException('TSocket: timed out reading '.$len.' bytes
> from '.
> @@ -224,7 +224,7 @@
>          }
>        } else if (($sz = strlen($buf)) < $len) {
>          $md = stream_get_meta_data($this->handle_);
> -        if ($md['timed_out']) {
> +        if (true === $md['timed_out'] && false === $md['blocked']) {
>            throw new TException('TSocket: timed out reading '.$len.' bytes
> from '.
>                                 $this->host_.':'.$this->port_);
>          } else {
> 
> 
> Is this code generated by thrift? Is there somewhere I can put a bug in?
> 
> Thanks.
> 
> On Mon, Feb 23, 2009 at 12:00 PM, Gary Richardson <ga...@gmail.com>
> wrote:
>> That got the job done.
>> 
>> BTW, I also had to re-thrift the hive_service stuff -- it was missing a class
>> or two.
>> 
>> Thanks!
>> 
>> 
>> On Mon, Feb 23, 2009 at 10:24 AM, Raghu Murthy <ra...@facebook.com> wrote:
>>> Hi Gary,
>>> 
>>> Looks like the php thrift infrastructure api is not completely packaged into
>>> hive. I have created a new jira to include these files.
>>> https://issues.apache.org/jira/browse/HIVE-299
>>> 
>>> In the meanwhile can you try downloading and building thrift? That should
>>> generate the necessary files.
>>> http://incubator.apache.org/thrift/download/
>>> 
>>> raghu
>>> 
>>> On 2/23/09 10:11 AM, "Gary Richardson" <ga...@gmail.com> wrote:
>>> 
>>>>> Hi,
>>>>> 
>>>>> I'm trying to work with the PHP thrift api and I've hit a stumbling block.
>>>>> 
>>>>> My script looks like:
>>>>> 
>>>>>>> #!/usr/bin/php
>>>>>>> <?php
>>>>>>> 
>>>>>>> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
>>>>>>> 
>>>>>>> require_once $GLOBALS['THRIFT_ROOT'] .
>>>>>>> 'packages/hive_service/ThriftHive.php';
>>>>> 
>>>>> And I'm getting the following error when I try to run it:
>>>>> 
>>>>>>> PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php):
>>>>>>> failed
>>>>>>> to open stream: No such file or directory in
>>>>>>> 
>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_ty>>>
p
>>>>> 
>>> e
>>>>>>> s.php on line 9
>>>>>>> PHP Warning:  include_once(): Failed opening
>>>>>>> 'thriftroot//packages/fb303/fb303_types.php' for inclusion
>>>>>>> (include_path='.:/usr/share/pear:/usr/share/php') in
>>>>>>> 
>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_ty>>>
p
>>>>> 
>>> e
>>>>>>> s.php on line 9
>>>>>>> PHP Warning:
>>>>>>> 
>>>>> 
include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php)>>>>>
:
>>>>>>> failed to open stream: No such file or directory in
>>>>>>> 
>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_ty>>>
p
>>>>> 
>>> e
>>>>>>> s.php on line 10
>>>>>>> PHP Warning:  include_once(): Failed opening
>>>>>>> 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for
>>>>> inclusion
>>>>>>> (include_path='.:/usr/share/pear:/usr/share/php') in
>>>>>>> 
>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_ty>>>
p
>>>>> 
>>> e
>>>>>>> s.php on line 10
>>>>>>> PHP Warning:
>>>>>>> 
>>>>> include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php):
>>>>>>> failed to open stream: No such file or directory in
>>>>>>> 
>>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.ph>>>>>
p
>>>>>>> on
>>>>>>> line 10
>>>>>>> PHP Warning:  include_once(): Failed opening
>>>>>>> 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for
>>>>> inclusion
>>>>>>> (include_path='.:/usr/share/pear:/usr/share/php') in
>>>>>>> 
>>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.ph>>>>>
p
>>>>>>> on
>>>>>>> line 10
>>>>>>> PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
>>>>>>> 
>>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.ph>>>>>
p
>>>>>>> on
>>>>>>> line 12
>>>>> I found FacebookBase.php, but my searching/googling hasn't revealed a
>>>>> fb303_types.php. My packages directory looks like:
>>>>> 
>>>>> [root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
>>>>> thriftroot/packages/hive_service/ThriftHive.php
>>>>> thriftroot/packages/hive_service/hive_service_types.php
>>>>> thriftroot/packages/fb303/FacebookBase.php
>>>>> 
>>>>> Is there a package somewhere that has the fb303 thrift code in it? Do I
>>>> need
>>>>> to build it myself?
>>>>> 
>>>>> Thanks!
>>> 
>> 
> 


Re: PHP - fb303_types.php

Posted by Raghu Murthy <ra...@facebook.com>.
Hi Gary,

Thanks for putting this together! Please check out the patch for HIVE-299
and let me know if it works for you without having to deal with thrift
directly.

raghu

On 2/24/09 2:18 PM, "Gary Richardson" <ga...@gmail.com> wrote:

> Hey guys,
> 
> Thanks for all the help. I've posted my howto on my blog:
> http://www.cultofgary.com/2009/02/24/making-php-talk-to-hive-through-thrift/
> 
> Thanks!
> 
> On Mon, Feb 23, 2009 at 2:58 PM, Gary Richardson <ga...@gmail.com>
> wrote:
>> Hey guys,
>> 
>> I've pretty much got everything working now with my php setup. Thanks for all
>> the help. I plan on putting a summary of how to get PHP talking to Hive at
>> some point soon.
>> 
>> I did run into one problem with reading results. The TSocket readAll() method
>> would throw a timeout exception. Commenting out those exceptions made the
>> code 
>> work. I dug a bit deeper and it looks the socket has timed_out == true while
>> it's blocking (blocked === true). I patched my copy to get it going:
>> 
>> @@ -213,7 +213,7 @@
>>      $pre = null;
>>      while (TRUE) {
>>        $buf = @fread($this->handle_, $len);
>> -      if ($buf === FALSE || $buf === '') {
>> +      if ($buf === FALSE) {
>>          $md = stream_get_meta_data($this->handle_);
>>          if ($md['timed_out']) {
>>            throw new TException('TSocket: timed out reading '.$len.' bytes
>> from '.
>> @@ -224,7 +224,7 @@
>>          }
>>        } else if (($sz = strlen($buf)) < $len) {
>>          $md = stream_get_meta_data($this->handle_);
>> -        if ($md['timed_out']) {
>> +        if (true === $md['timed_out'] && false === $md['blocked']) {
>>            throw new TException('TSocket: timed out reading '.$len.' bytes
>> from '.
>>                                 $this->host_.':'.$this->port_);
>>          } else {
>> 
>> 
>> Is this code generated by thrift? Is there somewhere I can put a bug in?
>> 
>> Thanks.
>> 
>> 
>> On Mon, Feb 23, 2009 at 12:00 PM, Gary Richardson <ga...@gmail.com>
>> wrote:
>>> That got the job done.
>>> 
>>> BTW, I also had to re-thrift the hive_service stuff -- it was missing a
>>> class 
>>> or two.
>>> 
>>> Thanks!
>>> 
>>> 
>>> On Mon, Feb 23, 2009 at 10:24 AM, Raghu Murthy <ra...@facebook.com> wrote:
>>>> Hi Gary,
>>>> 
>>>> Looks like the php thrift infrastructure api is not completely packaged
>>>> into
>>>> hive. I have created a new jira to include these files.
>>>> https://issues.apache.org/jira/browse/HIVE-299
>>>> 
>>>> In the meanwhile can you try downloading and building thrift? That should
>>>> generate the necessary files.
>>>> http://incubator.apache.org/thrift/download/
>>>> 
>>>> raghu
>>>> 
>>>> On 2/23/09 10:11 AM, "Gary Richardson" <ga...@gmail.com> wrote:
>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I'm trying to work with the PHP thrift api and I've hit a stumbling
>>>>> block.
>>>>>> 
>>>>>> My script looks like:
>>>>>> 
>>>>>>>> #!/usr/bin/php
>>>>>>>> <?php
>>>>>>>> 
>>>>>>>> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
>>>>>>>> 
>>>>>>>> require_once $GLOBALS['THRIFT_ROOT'] .
>>>>>>>> 'packages/hive_service/ThriftHive.php';
>>>>>> 
>>>>>> And I'm getting the following error when I try to run it:
>>>>>> 
>>>>>>>> PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php):
>>>>>>>> failed
>>>>>>>> to open stream: No such file or directory in
>>>>>>>> 
>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_t>>>>
y
>>>> p>>
>>>> e
>>>>>>>> s.php on line 9
>>>>>>>> PHP Warning:  include_once(): Failed opening
>>>>>>>> 'thriftroot//packages/fb303/fb303_types.php' for inclusion
>>>>>>>> (include_path='.:/usr/share/pear:/usr/share/php') in
>>>>>>>> 
>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_t>>>>
y
>>>> p>>
>>>> e
>>>>>>>> s.php on line 9
>>>>>>>> PHP Warning:
>>>>>>>> 
>>>>>> include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php
>>>>>> ):
>>>>>>>> failed to open stream: No such file or directory in
>>>>>>>> 
>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_t>>>>
y
>>>> p>>
>>>> e
>>>>>>>> s.php on line 10
>>>>>>>> PHP Warning:  include_once(): Failed opening
>>>>>>>> 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for
>>>>>> inclusion
>>>>>>>> (include_path='.:/usr/share/pear:/usr/share/php') in
>>>>>>>> 
>>>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_t>>>>
y
>>>> p>>
>>>> e
>>>>>>>> s.php on line 10
>>>>>>>> PHP Warning:
>>>>>>>> 
>>>>>> 
include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php)>>>>>>
:
>>>>>>>> failed to open stream: No such file or directory in
>>>>>>>> 
>>>>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.p
>>>>>> hp
>>>>>>>> on
>>>>>>>> line 10
>>>>>>>> PHP Warning:  include_once(): Failed opening
>>>>>>>> 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for
>>>>>> inclusion
>>>>>>>> (include_path='.:/usr/share/pear:/usr/share/php') in
>>>>>>>> 
>>>>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.p
>>>>>> hp
>>>>>>>> on
>>>>>>>> line 10
>>>>>>>> PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
>>>>>>>> 
>>>>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.p
>>>>>> hp
>>>>>>>> on
>>>>>>>> line 12
>>>>>> I found FacebookBase.php, but my searching/googling hasn't revealed a
>>>>>> fb303_types.php. My packages directory looks like:
>>>>>> 
>>>>>> [root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
>>>>>> thriftroot/packages/hive_service/ThriftHive.php
>>>>>> thriftroot/packages/hive_service/hive_service_types.php
>>>>>> thriftroot/packages/fb303/FacebookBase.php
>>>>>> 
>>>>>> Is there a package somewhere that has the fb303 thrift code in it? Do I
>>>>> need
>>>>>> to build it myself?
>>>>>> 
>>>>>> Thanks!
>>>> 
>>> 
>> 
> 


Re: PHP - fb303_types.php

Posted by Gary Richardson <ga...@gmail.com>.
Hey guys,

Thanks for all the help. I've posted my howto on my blog:
http://www.cultofgary.com/2009/02/24/making-php-talk-to-hive-through-thrift/

Thanks!

On Mon, Feb 23, 2009 at 2:58 PM, Gary Richardson
<ga...@gmail.com>wrote:

> Hey guys,
>
> I've pretty much got everything working now with my php setup. Thanks for
> all the help. I plan on putting a summary of how to get PHP talking to Hive
> at some point soon.
>
> I did run into one problem with reading results. The TSocket readAll()
> method would throw a timeout exception. Commenting out those exceptions made
> the code work. I dug a bit deeper and it looks the socket has timed_out ==
> true while it's blocking (blocked === true). I patched my copy to get it
> going:
>
> @@ -213,7 +213,7 @@
>      $pre = null;
>      while (TRUE) {
>        $buf = @fread($this->handle_, $len);
> -      if ($buf === FALSE || $buf === '') {
> +      if ($buf === FALSE) {
>          $md = stream_get_meta_data($this->handle_);
>          if ($md['timed_out']) {
>            throw new TException('TSocket: timed out reading '.$len.' bytes
> from '.
> @@ -224,7 +224,7 @@
>          }
>        } else if (($sz = strlen($buf)) < $len) {
>          $md = stream_get_meta_data($this->handle_);
> -        if ($md['timed_out']) {
> +        if (true === $md['timed_out'] && false === $md['blocked']) {
>            throw new TException('TSocket: timed out reading '.$len.' bytes
> from '.
>                                 $this->host_.':'.$this->port_);
>          } else {
>
>
> Is this code generated by thrift? Is there somewhere I can put a bug in?
>
> Thanks.
>
>
> On Mon, Feb 23, 2009 at 12:00 PM, Gary Richardson <
> gary.richardson@gmail.com> wrote:
>
>> That got the job done.
>>
>> BTW, I also had to re-thrift the hive_service stuff -- it was missing a
>> class or two.
>>
>> Thanks!
>>
>>
>> On Mon, Feb 23, 2009 at 10:24 AM, Raghu Murthy <ra...@facebook.com>wrote:
>>
>>> Hi Gary,
>>>
>>> Looks like the php thrift infrastructure api is not completely packaged
>>> into
>>> hive. I have created a new jira to include these files.
>>> https://issues.apache.org/jira/browse/HIVE-299
>>>
>>> In the meanwhile can you try downloading and building thrift? That should
>>> generate the necessary files.
>>> http://incubator.apache.org/thrift/download/
>>>
>>> raghu
>>>
>>> On 2/23/09 10:11 AM, "Gary Richardson" <ga...@gmail.com>
>>> wrote:
>>>
>>> > Hi,
>>> >
>>> > I'm trying to work with the PHP thrift api and I've hit a stumbling
>>> block.
>>> >
>>> > My script looks like:
>>> >
>>> >> #!/usr/bin/php
>>> >> <?php
>>> >>
>>> >> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
>>> >>
>>> >> require_once $GLOBALS['THRIFT_ROOT'] .
>>> >> 'packages/hive_service/ThriftHive.php';
>>> >
>>> > And I'm getting the following error when I try to run it:
>>> >
>>> >> PHP Warning:
>>>  include_once(thriftroot//packages/fb303/fb303_types.php):
>>> >> failed
>>> >> to open stream: No such file or directory in
>>> >>
>>>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>>> e
>>> >> s.php on line 9
>>> >> PHP Warning:  include_once(): Failed opening
>>> >> 'thriftroot//packages/fb303/fb303_types.php' for inclusion
>>> >> (include_path='.:/usr/share/pear:/usr/share/php') in
>>> >>
>>>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>>> e
>>> >> s.php on line 9
>>> >> PHP Warning:
>>> >>
>>> include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php):
>>> >> failed to open stream: No such file or directory in
>>> >>
>>>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>>> e
>>> >> s.php on line 10
>>> >> PHP Warning:  include_once(): Failed opening
>>> >> 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for
>>> inclusion
>>> >> (include_path='.:/usr/share/pear:/usr/share/php') in
>>> >>
>>>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>>> e
>>> >> s.php on line 10
>>> >> PHP Warning:
>>> >>
>>> include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php):
>>> >> failed to open stream: No such file or directory in
>>> >>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>>> >> on
>>> >> line 10
>>> >> PHP Warning:  include_once(): Failed opening
>>> >> 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for
>>> inclusion
>>> >> (include_path='.:/usr/share/pear:/usr/share/php') in
>>> >>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>>> >> on
>>> >> line 10
>>> >> PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
>>> >>
>>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>>> >> on
>>> >> line 12
>>> > I found FacebookBase.php, but my searching/googling hasn't revealed a
>>> > fb303_types.php. My packages directory looks like:
>>> >
>>> > [root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
>>> > thriftroot/packages/hive_service/ThriftHive.php
>>> > thriftroot/packages/hive_service/hive_service_types.php
>>> > thriftroot/packages/fb303/FacebookBase.php
>>> >
>>> > Is there a package somewhere that has the fb303 thrift code in it? Do I
>>> need
>>> > to build it myself?
>>> >
>>> > Thanks!
>>>
>>>
>>
>

Re: PHP - fb303_types.php

Posted by Gary Richardson <ga...@gmail.com>.
Hey guys,

I've pretty much got everything working now with my php setup. Thanks for
all the help. I plan on putting a summary of how to get PHP talking to Hive
at some point soon.

I did run into one problem with reading results. The TSocket readAll()
method would throw a timeout exception. Commenting out those exceptions made
the code work. I dug a bit deeper and it looks the socket has timed_out ==
true while it's blocking (blocked === true). I patched my copy to get it
going:

@@ -213,7 +213,7 @@
     $pre = null;
     while (TRUE) {
       $buf = @fread($this->handle_, $len);
-      if ($buf === FALSE || $buf === '') {
+      if ($buf === FALSE) {
         $md = stream_get_meta_data($this->handle_);
         if ($md['timed_out']) {
           throw new TException('TSocket: timed out reading '.$len.' bytes
from '.
@@ -224,7 +224,7 @@
         }
       } else if (($sz = strlen($buf)) < $len) {
         $md = stream_get_meta_data($this->handle_);
-        if ($md['timed_out']) {
+        if (true === $md['timed_out'] && false === $md['blocked']) {
           throw new TException('TSocket: timed out reading '.$len.' bytes
from '.
                                $this->host_.':'.$this->port_);
         } else {


Is this code generated by thrift? Is there somewhere I can put a bug in?

Thanks.

On Mon, Feb 23, 2009 at 12:00 PM, Gary Richardson <gary.richardson@gmail.com
> wrote:

> That got the job done.
>
> BTW, I also had to re-thrift the hive_service stuff -- it was missing a
> class or two.
>
> Thanks!
>
>
> On Mon, Feb 23, 2009 at 10:24 AM, Raghu Murthy <ra...@facebook.com> wrote:
>
>> Hi Gary,
>>
>> Looks like the php thrift infrastructure api is not completely packaged
>> into
>> hive. I have created a new jira to include these files.
>> https://issues.apache.org/jira/browse/HIVE-299
>>
>> In the meanwhile can you try downloading and building thrift? That should
>> generate the necessary files.
>> http://incubator.apache.org/thrift/download/
>>
>> raghu
>>
>> On 2/23/09 10:11 AM, "Gary Richardson" <ga...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > I'm trying to work with the PHP thrift api and I've hit a stumbling
>> block.
>> >
>> > My script looks like:
>> >
>> >> #!/usr/bin/php
>> >> <?php
>> >>
>> >> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
>> >>
>> >> require_once $GLOBALS['THRIFT_ROOT'] .
>> >> 'packages/hive_service/ThriftHive.php';
>> >
>> > And I'm getting the following error when I try to run it:
>> >
>> >> PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php):
>> >> failed
>> >> to open stream: No such file or directory in
>> >>
>>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>> e
>> >> s.php on line 9
>> >> PHP Warning:  include_once(): Failed opening
>> >> 'thriftroot//packages/fb303/fb303_types.php' for inclusion
>> >> (include_path='.:/usr/share/pear:/usr/share/php') in
>> >>
>>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>> e
>> >> s.php on line 9
>> >> PHP Warning:
>> >>
>> include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php):
>> >> failed to open stream: No such file or directory in
>> >>
>>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>> e
>> >> s.php on line 10
>> >> PHP Warning:  include_once(): Failed opening
>> >> 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for
>> inclusion
>> >> (include_path='.:/usr/share/pear:/usr/share/php') in
>> >>
>>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
>> e
>> >> s.php on line 10
>> >> PHP Warning:
>> >>
>> include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php):
>> >> failed to open stream: No such file or directory in
>> >>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>> >> on
>> >> line 10
>> >> PHP Warning:  include_once(): Failed opening
>> >> 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for
>> inclusion
>> >> (include_path='.:/usr/share/pear:/usr/share/php') in
>> >>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>> >> on
>> >> line 10
>> >> PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
>> >>
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>> >> on
>> >> line 12
>> > I found FacebookBase.php, but my searching/googling hasn't revealed a
>> > fb303_types.php. My packages directory looks like:
>> >
>> > [root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
>> > thriftroot/packages/hive_service/ThriftHive.php
>> > thriftroot/packages/hive_service/hive_service_types.php
>> > thriftroot/packages/fb303/FacebookBase.php
>> >
>> > Is there a package somewhere that has the fb303 thrift code in it? Do I
>> need
>> > to build it myself?
>> >
>> > Thanks!
>>
>>
>

Re: PHP - fb303_types.php

Posted by Gary Richardson <ga...@gmail.com>.
That got the job done.

BTW, I also had to re-thrift the hive_service stuff -- it was missing a
class or two.

Thanks!

On Mon, Feb 23, 2009 at 10:24 AM, Raghu Murthy <ra...@facebook.com> wrote:

> Hi Gary,
>
> Looks like the php thrift infrastructure api is not completely packaged
> into
> hive. I have created a new jira to include these files.
> https://issues.apache.org/jira/browse/HIVE-299
>
> In the meanwhile can you try downloading and building thrift? That should
> generate the necessary files.
> http://incubator.apache.org/thrift/download/
>
> raghu
>
> On 2/23/09 10:11 AM, "Gary Richardson" <ga...@gmail.com> wrote:
>
> > Hi,
> >
> > I'm trying to work with the PHP thrift api and I've hit a stumbling
> block.
> >
> > My script looks like:
> >
> >> #!/usr/bin/php
> >> <?php
> >>
> >> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
> >>
> >> require_once $GLOBALS['THRIFT_ROOT'] .
> >> 'packages/hive_service/ThriftHive.php';
> >
> > And I'm getting the following error when I try to run it:
> >
> >> PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php):
> >> failed
> >> to open stream: No such file or directory in
> >>
>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
> e
> >> s.php on line 9
> >> PHP Warning:  include_once(): Failed opening
> >> 'thriftroot//packages/fb303/fb303_types.php' for inclusion
> >> (include_path='.:/usr/share/pear:/usr/share/php') in
> >>
>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
> e
> >> s.php on line 9
> >> PHP Warning:
> >>
> include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php):
> >> failed to open stream: No such file or directory in
> >>
>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
> e
> >> s.php on line 10
> >> PHP Warning:  include_once(): Failed opening
> >> 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for
> inclusion
> >> (include_path='.:/usr/share/pear:/usr/share/php') in
> >>
>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
> e
> >> s.php on line 10
> >> PHP Warning:
> >>
> include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php):
> >> failed to open stream: No such file or directory in
> >>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
> >> on
> >> line 10
> >> PHP Warning:  include_once(): Failed opening
> >> 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for
> inclusion
> >> (include_path='.:/usr/share/pear:/usr/share/php') in
> >>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
> >> on
> >> line 10
> >> PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
> >>
> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
> >> on
> >> line 12
> > I found FacebookBase.php, but my searching/googling hasn't revealed a
> > fb303_types.php. My packages directory looks like:
> >
> > [root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
> > thriftroot/packages/hive_service/ThriftHive.php
> > thriftroot/packages/hive_service/hive_service_types.php
> > thriftroot/packages/fb303/FacebookBase.php
> >
> > Is there a package somewhere that has the fb303 thrift code in it? Do I
> need
> > to build it myself?
> >
> > Thanks!
>
>

Re: PHP - fb303_types.php

Posted by Raghu Murthy <ra...@facebook.com>.
Hi Gary,

Looks like the php thrift infrastructure api is not completely packaged into
hive. I have created a new jira to include these files.
https://issues.apache.org/jira/browse/HIVE-299

In the meanwhile can you try downloading and building thrift? That should
generate the necessary files.
http://incubator.apache.org/thrift/download/

raghu

On 2/23/09 10:11 AM, "Gary Richardson" <ga...@gmail.com> wrote:

> Hi,
> 
> I'm trying to work with the PHP thrift api and I've hit a stumbling block.
> 
> My script looks like:
> 
>> #!/usr/bin/php
>> <?php
>> 
>> $GLOBALS['THRIFT_ROOT'] = 'thriftroot/';
>> 
>> require_once $GLOBALS['THRIFT_ROOT'] .
>> 'packages/hive_service/ThriftHive.php';
> 
> And I'm getting the following error when I try to run it:
> 
>> PHP Warning:  include_once(thriftroot//packages/fb303/fb303_types.php):
>> failed 
>> to open stream: No such file or directory in
>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
e
>> s.php on line 9
>> PHP Warning:  include_once(): Failed opening
>> 'thriftroot//packages/fb303/fb303_types.php' for inclusion
>> (include_path='.:/usr/share/pear:/usr/share/php') in
>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
e
>> s.php on line 9
>> PHP Warning:  
>> include_once(thriftroot//packages/hive_metastore/hive_metastore_types.php):
>> failed to open stream: No such file or directory in
>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
e
>> s.php on line 10
>> PHP Warning:  include_once(): Failed opening
>> 'thriftroot//packages/hive_metastore/hive_metastore_types.php' for inclusion
>> (include_path='.:/usr/share/pear:/usr/share/php') in
>> 
/root/leap/dev/servers/hive/thriftroot/packages/hive_service/hive_service_typ>>
e
>> s.php on line 10
>> PHP Warning:  
>> include_once(thriftroot//packages/hive_metastore/ThriftHiveMetastore.php):
>> failed to open stream: No such file or directory in
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>> on 
>> line 10
>> PHP Warning:  include_once(): Failed opening
>> 'thriftroot//packages/hive_metastore/ThriftHiveMetastore.php' for inclusion
>> (include_path='.:/usr/share/pear:/usr/share/php') in
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>> on 
>> line 10
>> PHP Fatal error:  Interface 'ThriftHiveMetastoreIf' not found in
>> /root/leap/dev/servers/hive/thriftroot/packages/hive_service/ThriftHive.php
>> on 
>> line 12
> I found FacebookBase.php, but my searching/googling hasn't revealed a
> fb303_types.php. My packages directory looks like:
> 
> [root@ip-10-250-31-17 hive]# find thriftroot/packages/ -type f
> thriftroot/packages/hive_service/ThriftHive.php
> thriftroot/packages/hive_service/hive_service_types.php
> thriftroot/packages/fb303/FacebookBase.php
> 
> Is there a package somewhere that has the fb303 thrift code in it? Do I need
> to build it myself?
> 
> Thanks!