Latest Apache Hive Interview Questions Part – 2
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.
How Can You Delete The Dbproperty In Hive?
There is no way you can delete the DBPROPERTY.
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.
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’)
Which Java Class Handles The Input Record Encoding Into Files Which Store The Tables In Hive?
org.apache.hadoop.mapred.TextInputFormat
Which Java Class Handles The Output Record Encoding Into Files Which Result From Hive Queries?
org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
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.
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.
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
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.
How Can You Stop A Partition Form Being Queried?
By using the ENABLE OFFLINE clause with ALTER TABLE atatement.
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.
If You Omit The Overwrite Clause While Creating A Hive Table,what Happens To File Which Are New And Files Which Already Exist?
The new incoming files are just added to the target directory and the existing files are simply overwritten. Other files whose name does not match any of the incoming files will continue to exist.
If you add the OVERWRITE clause then all the existing data in the directory will be deleted before new data is written.
What Does The Following Query Do? Insert Overwrite Table Employees Partition (country, State) Select …, Se.cnty, Se.st From Staged_employees Se;
It creates partition on table employees with partition values coming from the columns in the select clause. It is called Dynamic partition insert.
What Is A Table Generating Function On Hive?
A table generating function is a function which takes a single column as argument and expands it to multiple column or rows. Example exploe()
How Can Hive Avoid Mapreduce?
If we set the property hive.exec.mode.local.auto to true then hive will avoid mapreduce to fetch query results.