Is there a Hive equivalent to Pig’s PigRunner class that makes it easy to run HQL scripts from within a Java program?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
Spring for Apache Hadoopframework has aHiveintegration, having a look atthe source code might give you some idea how to run hql scripts from code.
On the other hand you can also check the
Hivesources as well (especially CliSessionState and CliDriver)to see how Hive shell picks up a hql file (i.e:
hive -f file.q) .Based on these such a raw implementation can do the job:
Note that a running
Thrift service(on port 10000 by default) is needed to be able to execute the script.