Hive interview questions

Hive @ Freshers.in

36. What does the “USE” command in hive do ?
With the use command you fix the database on which all the subsequent hive queries will run.
USE database_name;
USE DEFAULT;
USE sets the current database for all subsequent HiveQL statements. To revert to the default database, use the keyword “default” instead of a database name.

37. How can you delete the DBPROPERTY in Hive ?
There is no way you can delete the DBPROPERTY.

38. What is the significance of the line ?
set hive.mapred.mode = strict;
It sets the mapreduce jobs to strict mode.By which the queries on partitioned tables can not run without a WHERE clause. This prevents very large job running for long time.

39. How do you check if a particular partition exists ?
This can be done with following query
SHOW PARTITIONS table_name PARTITION(partitioned_column=’partition_value’)

40. Which java class handles the Input record encoding into files which store the tables in Hive ?
org.apache.hadoop.mapred.TextInputFormat

41. Which java class handles the output record encoding into files which result from Hive queries ?
org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat

42. What is the significance of ‘IF EXISTS” clause while dropping a table ?
When we issue the command DROP TABLE IF EXISTS table_name
Hive throws an error if the table being dropped does not exist in the first place
hive> DROP DATABASE IF EXISTS financials;
The IF EXISTS is optional and suppresses warnings if financials doesn’t exist.

Author: user

Leave a Reply