Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

Hive Interview Questions and Answers For Freshers Part-3

Be First!

hive21.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.

22.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’)

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

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

25.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.

26.When you point a partition of a hive table to a new directory, what happens to the data?
The data stays in the old location. It has to be moved manually.

27.Write a query to insert a new column(new_col INT) into a hiev table (htab) at a position before an existing column (x_col)
ALTER TABLE table_name
CHANGE COLUMN new_col INT
BEFORE x_col

28.Does the archiving of Hive tables give any space saving in HDFS?
No. It only reduces the number of files which becomes easier for namenode to manage.

29.How can you stop a partition form being queried?
By using the ENABLE OFFLINE clause with ALTER TABLE atatement.

30.While loading data into a hive table using the LOAD DATA clause, how do you specify it is a hdfs file and not a local file ?
By Omitting the LOCAL CLAUSE in the LOAD DATA statement.

(189)

Previous
Next

Leave a Reply