This article will show you how to create a batch file and use Hive shell to execute it.
1) Using gedit or any other accessible editor, create a script file with the following commands; be sure to update the table name accordingly.
select printf(‘output is as follows’);
select * from emp;
2) Save the file in the home directory with the extension .hql, .sql, or .q.
3) To invoke and execute the file in Hive, use the command below.
I hope you found the information in this post useful.