Omnitrix has asked for the wisdom of the Perl Monks concerning the following question:

I want to connect to Hive. it would be a life savior if I do not use the 'Thrift-API-HiveClient2-0.021' module. Any suggestions?

Replies are listed 'Best First'.
Re: Connect to Hive
by thanos1983 (Parson) on Apr 20, 2017 at 10:50 UTC

    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.

    Seeking for Perl wisdom...on the process of learning...not there...yet!