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" <[email protected]> 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 <[email protected]>
> 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 <[email protected]> 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" <[email protected]> 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:
>>>>> 
>>>>> [r...@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!
>>> 
>> 
> 

Reply via email to