How to proceed 2 executions in 1 step in hive?

I am wondering if there is a way to proceed 2 exectuions in 1 step in hive. For example:

SELECT * FROM TABLE1
SELECT * FROM TABLE2
;

Do this in one window, and do not have to open 2 hive windows to execute each line separetly.

Can it be done on HUE?

Topic hive

Category Data Science


Yes, you can execute multiple HQL's using Hue as long as each individual HQL is separated by a semi colon (;)


You can separate each query with a semi colon (;)

select column1 from table1;
select column2 from table2;

This command can be executed from command line via inline queries or a file. Usage of Hive CLI is not recommended. You must use beeline to execute queries configured via hive server 2 so that all/any underlying security control measures are honored.

you may invoke beeline with the command:

beeline

You can use HiveCLI Tool to run HiveQL with a given sql file.

$HIVE_HOME/bin/hive -f /home/my/hive-script.sql

Please see official document: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli

What you need to do is to

  1. Put your HiveQLs in a file as below
    SELECT * FROM TABLE1; SELECT * FROM TABLE2;

  2. Use HiveCLI and run with above file

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.