hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chinna Rao Lalam <lalamchinnara...@gmail.com>
Subject Re: How do I get the php client to run?
Date Fri, 28 Mar 2014 10:15:23 GMT
Hi,

  1. Start Hiveserver
  2. In php client code set THRIFT_ROOT to php lib of hive distribution
(Ex: /home/install/apache-hive-0.14.0-SNAPSHOT-bin/lib/php)

Hope It Helps,
Chinna


On Fri, Mar 28, 2014 at 12:14 AM, Jeremy <jking@kickbackpoints.com> wrote:

> Or how do query hive from php?
>
> On 03/27/2014 12:25 PM, Jeremy wrote:
> > Or is there another way I can pull data from hive using php?
> >
> > On 03/27/2014 11:54 AM, Jeremy wrote:
> >>
> https://cwiki.apache.org/confluence/display/Hive/HiveClient#HiveClient-PHP
> >>
> >> What kind of setup and what do I need to do to get this client to run?
> >>
> >>
> >> <?php
> >> // set THRIFT_ROOT to php directory of the hive distribution
> >> $GLOBALS['THRIFT_ROOT'] = '/lib/php/';
> >> // load the required files for connecting to Hive
> >> require_once $GLOBALS['THRIFT_ROOT'] .
> >> 'packages/hive_service/ThriftHive.php';
> >> require_once $GLOBALS['THRIFT_ROOT'] . 'transport/TSocket.php';
> >> require_once $GLOBALS['THRIFT_ROOT'] . 'protocol/TBinaryProtocol.php';
> >> // Set up the transport/protocol/client
> >> $transport = new TSocket('localhost', 10000);
> >> $protocol = new TBinaryProtocol($transport);
> >> $client = new ThriftHiveClient($protocol);
> >> $transport->open();
> >>
> >> // run queries, metadata calls etc
> >> $client->execute('SELECT * from src');
> >> var_dump($client->fetchAll());
> >> $transport->close();
> >>
> >> Thanks
> >>
>

Mime
View raw message