Hi,

I do have troubles setting up the Hive client for PHP using Thrift. I have 
searched the web for hours, but I have only found one tutorial about this 
topic. Unfortunately this tutorial seems to be a little outdated.
http://www.cultofgary.com/2009/02/24/making-php-talk-to-hive-through-thrift/

I have downloaded and installed Thrift using the following commands:
> ./configure --without-ruby
> make
> make install

Then I generated the thrift packages fb303, hive_metastore and hive_service as 
described in the tutorial. Running the PHP-example code lead to the following 
error:

> php hiveClientTest.php 
PHP Parse error:  syntax error, unexpected T_GLOBAL, expecting T_STRING in 
/movies/home/hadoop/HiveClient/packages/hive_metastore/hive_metastore_types.php 
on line 21

Here might be a bug in line 21, because a constant attribute named GLOBAL is 
defined there. "global" is a keyword in PHP, that's why it might by a bug, see 
http://php.net/manual/en/reserved.keywords.php. I fixed it by renaming the 
constant to _GLOBAL. I really don't know what side-effects might come up with 
this fix.

Then I figured out that the Thrift package queryplan is missing. So I generated 
this one using the following commands and moved it into my php test environment.
> cd /usr/local/hive/src/ql/src
> thrift --gen php -I include if/queryplan.thrift 

Starting the Hive-Server using:
> hive --service hiveserver &

I am finally able to run my hiveClientTest.php, but I still get an error.

FAILED: Hive Internal Error: java.lang.RuntimeException(Error while making MR 
scratch directory - check filesystem config (null))
java.lang.RuntimeException: Error while making MR scratch directory - check 
filesystem config (null)
...
Caused by: java.lang.IllegalArgumentException: Wrong FS: 
hdfs://xxx.xxx.xxx.xxx:8020/tmp/hive-hadoop/hive_2011-12-19_17-58-11_235_2846966944739419,
 expected: hdfs://servername.domain.com

I tried to manage this using /etc/hosts, but it's not working. :-(

Can anyone help me out here? And is my approach right? Or am I missing 
something? Have I done sth. wrong? Is there an step-by-step guide somewhere out 
there that I have missed?

Cheers,
K.



-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

Reply via email to