It's good that Hive Server 2 supports ODBC, but it does so by sending ODBC requests to the Thrift interface. I decided to cut out the middleman and the complexity. YMMV.
The school solution for doing this in Perl is the CPAN module Thrift::API::HiveClient2.
A simple piece of sample code:
my $client = Thrift::API::HiveClient2->new ( host => $host, port => $port, timeout => $timeout, username => $username, password => $password, ); $client->connect or die "Could not connect"; my $rh = $client->execute($query); # will die with an error if it fails my $return = []; while (my $latest_return = $client->fetch($rh)) { # will die with an error if it fails push @$return, @$latest_return; }