In this article, we have listed the frequently asked hive interview questions and answers which will assist you in getting accomplishment in your interview.
Top Apache Hive Interview Questions and Answers
Q1. What do you know about Apache Hive?
It is a data warehouse tool, developed on the top of Apache Hadoop to give the data analysis & query. It provides an interface similar to SQL to query data stored in various databases and file systems that integrate with Hadoop.
Q2. What are the different kinds of tables available in Hive?
Apache hive has two types of tables:
- Managed table: both the data and schema in controlled by Hive
- External table: only the schema is controlled by Hive.
Q3. What type of applications are supported by Apache Hive?
All client applications which are written in Java, PHP, Python, C++ or Ruby supported by, Hive.
Q4. Where the data of a Hive table is stored?
By default, data of a Hive table is stored in an HDFS directory – /user/hive/warehouse. Moreover, by providing the desired directory in hive.metastore.warehouse.dir configuration parameter present in the hive-site.xml, we can change the location to store data.
Q5. Can we use Hive for OLTP systems?
No, we can’t use Hive for OLTP systems because it doesn’t offer insert and update at row level.
Q6. What do you know about a metastore in Hive?
It is used to store the metadata information in the Hive.
Q7. Tell me the difference between local and remote metastore?
- Local Metastore: a metastore service that executes in the same JVM in which the Hive service is executing and connects to a database running in a separate JVM. Either on the same machine or on a remote machine.
- Remote Metastore: In this configuration, the metastore service runs on its own separate JVM and not in the Hive service JVM.
Q8. What is the default database available in Apache Hive for metastore?
By default, Apache Hive has an embedded Derby database instance backed by the local disk for the metastore.
Q9. Can we change the default location of a managed table?
Ans. Yes, we can change the default location of a managed table by using the clause – LOCATION ‘<hdfs_path>’.
Q10. Can we rename a table in Hive?
Yes, we can rename of a table in Hive by using clause: Alter Table table_name RENAME TO new_name.
Q11. What do you mean by partition in Hive?
The partition is a sub-directory in the table directory. Hive organizes tables into partitions to group the similar type of data together on the basis of column or partition key.
Q12. What are the different modes in which the hive can be run?
Hive runs in three different modes, which are:
- Local mode
- Distributed mode
- Pseudodistributed mode
Q13. What is the date data type in Hive?
The TIMESTAMP data types stores date in java.sql.timestamp format
Q14. What are collection data types in Hive?
There are three collection data types in Hive.
Q15. Can we execute Hive queries from script files? How?
Yes, we can execute the Hive queries using the source command.
Hive> source /path/to/file/file_with_query.hql
I hope you find this article on Apache Hive interview questions & answers will you prepare for the interview. If there is an interview question that has been asked to you, kindly post it in the comment section.