in reply to Connect to Hive
Hello Omnitrix,
I do not know why you do not want to use the (Thrift::API::HiveClient2) but there is also (Thrift::API::HiveClient) I do not know if this will work for you?
Alternatively I found from (Perl Thrift client to Hive?):
use Thrift; use Thrift::Socket; use Thrift::FramedTransport; use Thrift::BinaryProtocol; use lib <LOCATION OF GENERATED PERL CODE>; use ThriftHive; # init variables ($host, $port, $query) # my $socket = Thrift::Socket->new($host, $port); my $transport = Thrift::BufferedTransport->new($socket); my $protocol = Thrift::BinaryProtocol->new($transport); my $client = ThriftHiveClient->new($protocol); eval {$transport->open()}; #do something with Exceptions eval {$client->execute($query)}; for (my $i = 0; $i < $count; $i++) { my $row; eval {$row = $client->fetchOne()}; #use $row } $transport->close();
I have not tested the code, but looks correct as acceptable solution.
Update: take a look also on the official documentation (Apache Thrift Perl Tutorial) which contains a Client and Server example script.
Hope this helps.
|
|---|