Automattic / php-thrift-sql

A PHP library for connecting to Hive or Impala over Thrift
GNU General Public License v2.0
113 stars 42 forks source link

Exception only because there is no match rows #23

Closed ufoe closed 5 years ago

ufoe commented 7 years ago

I got an time out exception when there is no rows macthed

select * from dbname.tablename limit 10 // ok

select * from dbname.tablename where metricname='x' limit 10 //no match rows

I got the flowing exception message:

Fatal error: Uncaught Thrift\Exception\TTransportException: TSocket: timed out reading 4 bytes from 192.168.2.32:21000:21000 in phar://php-thrift-sql/ThriftSQL.phar/Thrift/Transport/TSocket.php:274 Stack trace: #0 phar://php-thrift-sql/ThriftSQL.phar/Thrift/Transport/TTransport.php(74): Thrift\Transport\TSocket->read(4) #1 phar://php-thrift-sql/ThriftSQL.phar/Thrift/Protocol/TBinaryProtocol.php(305): Thrift\Transport\TTransport->readAll(4) #2 phar://php-thrift-sql/ThriftSQL.phar/Thrift/Protocol/TBinaryProtocol.php(197): Thrift\Protocol\TBinaryProtocol->readI32(NULL) #3 phar://php-thrift-sql/ThriftSQL.phar/Packages/Beeswax/BeeswaxService.php(325): Thrift\Protocol\TBinaryProtocol->readMessageBegin(NULL, 0, 0) #4 phar://php-thrift-sql/ThriftSQL.phar/Packages/Beeswax/BeeswaxService.php(292): ThriftSQL\BeeswaxServiceClient->recv_fetch() #5 phar://php-thrift-sql/ThriftS in phar://php-thrift-sql/ThriftSQL.phar/Thrift/Transport/TSocket.php on line 274

FrankDaze commented 7 years ago

to avoid timeouts you can add a timeout time to this line $hive = new \ThriftSQL\Hive( 'host' , 10000, 'user', 'password', 30);

In my case it's 30.

But at the end I also can not get results if I user a WHERE in the query.

I get this error: Fatal error: Uncaught exception 'ThriftSQL\Exception' with message 'Hive ERROR_STATE Error Message: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask' in phar:///Library/WebServer/Documents/LPS_Tool/ThriftSQL.phar/ThriftSQL/Hive.php:102 Stack trace: #0 /Library/WebServer/Documents/LPS_Tool/hiveTest.php(8): ThriftSQL\Hive->queryAndFetchAll('SELECT * FROM t...') #1 {main} thrown in phar:///Library/WebServer/Documents/LPS_Tool/ThriftSQL.phar/ThriftSQL/Hive.php on line 102

FrankDaze commented 7 years ago

ok my issue is solved. The problem was das my username had to be upppercase instead of lowercase.