Hive tips and shortcuts

Hive tips and shortcuts

#execute a query in Silent(S)Mode

 
 
  1. hive -S -e "your hive query"

#execute a query

 
 
  1. hive -e "your hive query"

 

#show current database

 
 
  1. hive>SET hive.cli.print.CURRENT.db=TRUE;

 

#show all column names for a table

 
 
  1. hive>SET hive.cli.print.header=TRUE;

 

#to run all pre required commands in one go

1.create .hiverc file in your root directory.

2.put all commands in .hiverc file.

Now all commands will run when you enter in to hive.

 

#run shell commands without exiting hive

  1. put ! before shell commands.

Examples:-

 
 
  1. hive> ! hadoop fs -ls ;
  2. hive> ! ls ;

 

#run a hql file in Hive CLI

 
 
  1. hive> SOURCE <location_Of/hql_File>

 

#run a hql file in unix:

 
 
  1. hive -f <location_Of/hql_File>

 

#you can save hive query file with extension .q or .hql;

 

1

Join in hive with example

Requirement You have two table named as A and B. and you want to perform all types of join in ...
Read More

Join in pyspark with example

Requirement You have two table named as A and B. and you want to perform all types of join in ...
Read More

Join in spark using scala with example

Requirement You have two table named as A and B. and you want to perform all types of join in ...
Read More

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.