Hive tips and shortcuts

Hive tips and shortcuts

#execute a query in Silent(S)Mode

 
 
hive -S -e "your hive query"

#execute a query

 
 
hive -e "your hive query"

 

#show current database

 
 
hive>set hive.cli.print.current.db=true;

 

#show all column names for a table

 
 
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:-

 
 
hive> ! hadoop fs -ls ;
hive> ! ls ;

 

#run a hql file in Hive CLI

 
 
hive> source <location_Of/hql_File>

 

#run a hql file in unix:

 
 
hive -f <location_Of/hql_File>

 

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

 

1
0

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

Java UDF to convert String to date in PIG

About Code Many times it happens like you have received data from many systems and each system operates on a ...
Read More
/ java udf, Pig, pig, pig udf, string to date, udf

Leave a Reply

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