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

Oh great and noble PerlMonks, your help will be greatly appreciated. Having to go Hadoop as MySQL has run out of gas with the amount of data we have to manipulate these days.

CentOS 7.3, yum installed the Thrift::API::HiveClient2, connecting to a hiveserver2 server, so it looks like I have the proper software for this to work.

My test Perl code:

#!/usr/bin/perl use strict; use Thrift::API::HiveClient2; use Data::Dumper; use Try::Tiny; print "\ncreate hive client\n"; my $client = Thrift::API::HiveClient2->new( host => 'hadoop03', port = +> 10000, timeout => 300); print "\nconnect to hive client\n"; $client->connect() or die "\nFailed to connect\n"; try sub { print "\ngetting COUNT(*) with Hive\n"; my $sql = "SELECT COUNT(*) AS `RowCount` FROM DaysTable WHERE Tran +sactionDate = '2018-07-01';"; my $rowCnt = 0; print "\n before execute \n"; my $rows = $client->execute( "$sql" ) or die "\nexecute failed\n"; print "\n after execute \n"; while (my $row = $client->fetch_hashref( $rows )) { print "\n before rowCnt \n"; $rowCnt = $row->{ 'RowCount' }; } print "\n\n\tRows from <$sql>\n\t<$rowCnt>\n\n"; }, catch sub { print "\n at the catch\n"; print Dumper( $_ ); exit; };

Then I run it, I get this:

create hive client connect to hive client getting COUNT(*) with Hive before execute at the catch $VAR1 = bless( { 'code' => 0, 'message' => 'Missing version identifier' }, 'Thrift::TException' );

So, I can create the client, I can connect, but when I try and execute, I get this error. When I use Hue, I can get to the server and get data returned, so it looks like Hadoop is working. I've done searches on PerlMonks and the web and haven't come up with a good solution to this issue. A few folks have asked the question but not given enough supporting documentation.

I hope this gives you enough information, if not, let me know. Hopefully someone has seen this before and will be able to say,"Oh yeah, just do this."

Thanks in advance!

Ken Hylton

Replies are listed 'Best First'.
Re: Missing version identifier - Thrift::API::HiveClient2
by choroba (Cardinal) on Jul 25, 2018 at 11:48 UTC
    Sorry for not answering the question, but for pure curiosity, why are you using
    try sub { ... }, catch sub { ... };

    instead of

    try { ... } catch { ... };
    ?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

      Force of habit, I suppose. Works the same. Any thoughts on the hadoop issue?

        OK, did more research and found on the github of the authors of Thrift::API::HiveClient2 some good information. Need to add sasl => 1 to the client creation method. Then it will get past the SASL issue, but will complain about Kerberos issues. Having to look further at that now (but on the trail) as the consultant we had in to set up hadoop for us set it up with no security at all. Java can digest that it seems, but not sure about the Perl module.

        When I get this fully resolved, I'll update this post as others have hit this issue but didn't post solutions for others to see, or at least were simple enough for me to understand. Sort of Red Book information.

        Meanwhile, has anyone run hive server2 without Kerberos and got it to work? The .pm developers notes say they've only tested with Kerberos.

        Ken Hylton