NAME

Thrift::API::HiveClient - A Hadoop Hive client using the Thrift API

VERSION

version 0.003

DESCRIPTION

THIS CODE IS ALPHA-QUALITY, EXPERIMENTAL, AND LIKELY FLAMMABLE

That said, I decided it would be nice to make it easy to connect to a Hadoop Hive server via its Thrift interface and that's what this module provides. It tries to keep the gory details from you and make things as simple as possible. The majority of the code in this dist was generated by the thrift compiler, but is hidden behind the friendly facade of the module whose documentation you are reading now. Enjoy, and please feel free to send bug reports and/or patches!

ATTRIBUTES

host

The host on which the hiveserver process is running. Should be a valid hostname or IP address. required, immutable

port

The TCP port on which the hiveserver process is listening. Should be a valid port number. required, immutable

METHODS

new( ... )

Standard object constructor. Arguments are the attributes described above. For example:

my $cli = Thrift::API::HiveClient->new( host => 'localhost', port => 10000 );

connect( )

Connect to the configured hiveserver.

METHODS FROM ThriftHive

These are the methods exposed by the Thrift API. The HiveClient object simply acts as a proxy for all the methods available on the (underlying) ThriftHiveClient object.

However, for your convenience, all these methods are documented here, as well as I can.

execute( $hql )

The given HQL statement is sent to the hiveserver and executed. The results can be retrieved by using the fetch* methods.

$cli->execute('select * from foo');

fetchOne( )

fetchN( $num )

fetchAll( )

All results from a previous call to execute() are returned as an array

my $res = $cli->fetchAll();

getSchema( )

getThriftSchema( )

getClusterStatus( )

Returns an object (blessed hash) showing some of the status of the Hadoop cluster.

getQueryPlan( )

clean( )

METHODS FROM ThriftHiveMetastore

create_database( $db_name )

get_database( $db_name )

drop_database( $db_name, $drop_data )

get_databases( $pattern )

get_all_databases( )

alter_database( $db_name, $db )

get_type( $name )

create_type( $type )

drop_type( $type )

get_type_all( $name )

get_fields( $db_name, $table_name )

Returns an array of FieldSchema objects with info about the fields in the given table in the given database.

my $fields = $cli->get_fields( 'default', 'foo' );

get_schema( $db_name, $table_name )

create_table( $tbl )

drop_table( $db_name, $tbl_name, $delete_data )

get_tables( $db_name, $pattern )

get_all_tables( $db_name )

get_table( $db_name, $tbl_name )

alter_table( $db_name, $tbl_name, $new_tbl )

add_partition( $new_part )

append_partition( $db_name, $tbl_name, $part_vals )

append_partition_by_name( $db_name, $tbl_name, $part_name )

drop_partition( $db_name, $tbl_name, $part_vals, $delete_data )

drop_partition_by_name( $db_name, $tbl_name, $part_name, $delete_data )

get_partition( $db_name, $tbl_name, $part_vals )

get_partition_with_auth( $db_name, $tbl_name, $part_vals, $usr_name, $grp_names )

get_partition_by_name( $db_name, $tbl_name, $part_name )

get_partitions( $db_name, $tbl_name, $max_parts )

get_partitions_with_auth( $db_name, $tbl_name, $max_parts, $usr_name, $grp_names )

get_partition_names( $db_name, $tbl_name, $max_parts )

get_partitions_ps

get_partitions_ps_with_auth

get_partition_names_ps

get_partitions_by_filter

alter_partition

get_config_value( $name, $default )

partition_name_to_vals

partition_name_to_spec

add_index

alter_index

drop_index_by_name

get_index_by_name

get_indexes

get_index_names

create_role

drop_role

get_role_names

grant_role

revoke_role

list_roles

get_privilege_set

list_privileges

grant_privileges

revoke_privileges

get_delegation_token

get_delegation_token_with_signature

renew_delegation_token

cancel_delegation_token

METHODS FROM FacebookService

getName

getVersion

getStatus

getStatusDetails

getCounters

getCounter

setOption

getOption

getOptions

getCpuProfile

aliveSince

reinitialize

shutdown

EXTENDS

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-thrift-api-hiveclient at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Thrift-API-HiveClient. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/Hercynium/Thrift-API-HiveClient

git clone git://github.com/Hercynium/Thrift-API-HiveClient.git

AUTHOR

Stephen R. Scaffidi <sscaffidi@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2012 by Stephen R. Scaffidi.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004