Hadoop::HiveCLI - Run hive CLI processes with a given configuration
version 0.001
my $hive = Cmd::HiveRunner->new(
user => 'sscaffid',
conf => { foo => 'bar' }
);
# confs are merged, with conf in run getting precedence.
my $job = $hive->run(
conf => { 'mapred.job.queue.name' => 'default' },
query => q{select * from t_location LIMIT 5},
);
# if you want to run things synchronously, just do this.
$job->wait;
This is a class used to run queries via the Hive CLI, as a specific user and setting things like which mapreduce job queue to use.
Calling new
sets up an object with whatever you want your defaults to be, and makes sure the program can find your hive and sudo commands. (sudo is necessary to run jobs as a different user).
Then, you can kick off hive processes by calling run
with a query (in HQL), and as that process runs in the background, you can check on the progress, and get other potentially useful info about it.
The path to the sudo command. Will be auto-detected if not specified.
The path to the hive command. Will be auto-detected if not specified.
The user under which to run hive. Will use sudo to change users if necessary.
A hash of key => value pairs like would be passed to hive with the -hiveconf option.
Construct a new HiveRunner object
Run the hive CLI with the given settings. Accepted parameters:
- user
-
The user under which to run hive
- conf
-
Conf attributes to add-to or override those set in the object
- query
-
The HQL query you want Hive to run. required
Please report any bugs or feature requests by email to bug-hadoop-hivecli at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hadoop-HiveCLI. You will be automatically notified of any progress on the request by the system.
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/Hadoop-HiveCLI
git clone git://github.com/Hercynium/Hadoop-HiveCLI.git
Stephen R. Scaffidi <sscaffidi@cpan.org>
This software is copyright (c) 2012 by Stephen R. Scaffidi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.