Table of Contents
Looking for top Hive interview questions to practice that is frequently asked by interviewers? If yes, here is the blog that will guide you with a complete series of questions to get an in-depth knowledge of important Hive concepts. If you have attended any Hive interview previously then we encourage you to share those questions in the comment tab.
Hive Interview Questions
Here you can check top 15 hive interview questions which help you to crack the interview. Hive interview questions for the fresher and experienced user. You can also find the proper answers to these interview questions below.
- What is Hive?
- How Hive and HBase are different?
- What are the programming languages supported in Hive?
- How will you define a Metastore in Hive?
- Why Hive stores the metadata information in Metastore, not in HDFS?
- How does the data of a Hive table get stored?
- How will you differentiate the local Metastore and remote Metastore from each other?
- What is default database supported by the Hive Metastore?
- How will you differentiate the external table and managed table in Hive?
- What is the method to change the default location of a managed table?
- Define a partition in Hive.
- When should use SORT BY command instead of Order By command?
- What is the need for partitioning in Hive?
- How will you define the dynamic partitioning in Hive and when is it required?
- How many dynamic partitions can be created by a mapper or reducer in Hive? How can you change the default length?
Hive Interview Questions Answers for Freshers
Here you can check the top hive interview questions with answers for the fresher user. All hive interview questions are very important for the fresher user to crack the interview.
Q1). What is Hive?
Hive is a data warehouse system that is used to facilitate queries and managing large datasets residing in distributed storage. Hive programming language looks very much similar to the SQL language and named as the HiveQL. The platform allows traditional MapReduce programs to customize mapper and reducers when it is not convenient or efficient to execute logic in HiveQL.
Q2). How Hive and HBase are different?
Hive and HBase are generally used for different technologies based on the Hadoop. Hive is given as an infrastructure warehouse of data that is based on Hadoop and HBase in NoSQL. Queries in Hive are executed as MapReduce jobs internally and HBase operations run in the real-time. Hive provides high latency for huge datasets and HBase offers the low latency. Both platforms give random access to the data.
Q3). What are the programming languages supported in Hive?
Java, PHP, Python, C++, Ruby etc.
Q4). How will you define a Metastore in Hive?
A Metastore in Hive will store the metadata information using RDBMS and an open source layer called the Data Nucleus that converts objects relationship into the relational schema and vice versa.
Q5). Why Hive stores the metadata information in Metastore, not in HDFS?
Hive stores metadata information in Metastore using RDBMS, not the HDFS. The reason for choosing RDBMS is low latency. At the same time, read/write operations in HDFS is quite a time consuming when compared to RDBMS.
Q6). How does the data of a Hive table get stored?
By default, data for a Hive table is stored in the HDFS directory. Users had the flexibility to change the directory path by specifying any other desired directory.
Hive Interview Questions Answers for Experienced
Here you can check top hive interview questions with answers for the experienced user.
Q7). How will you differentiate the local Metastore and remote Metastore from each other?
In the case of local Metastore configuration, the Metastore service runs in the same JVM in which Hive services are running and connects to a different database running on to a different JVM. This JVM would either lie on the same machine or the remote machine.
In the case of remote Metastore configuration, the Metastore service runs on its own separate JVM, not in the Hive service JVM. You could have multiple Metastore servers here to provide maximum availability.
Q8). What is default database supported by the Hive Metastore?
An Embedded Debry database instance is supported by the Hive Metastore by default. It can also be named as the embedded Metastore configuration.
Q9). How will you differentiate the external table and managed table in Hive?
In the case of a managed table, if one puts the command “drop a managed table” then it will delete the complete table along with metadata information from the Hive warehouse dictionary. In contrary, when we put the same command for an external table then it will delete only metadata information but table data is still the same.
Q10). What is the method to change the default location of a managed table?
You should simply use the command – LOCATION ‘<hdfs_path>’.
Q11). Define a partition in Hive.
In Hive, data is organized in partitions where a similar type of data is grouped together based on the partition key. Each table could have one or more partitions keys to identify a specific partition. In simple words, a partition is nothing but a sub-directory in the table directory.
Q12). When should use SORT BY command instead of Order By command?
You should use Sort By when you are interested in sorting huge datasets because the command will use multiple reducers and makes the things little simpler. At the same time, Order By command is suitable for small datasets as it is using a single reducer only.
Q13). What is the need for partitioning in Hive?
Partitions in Hive are used to provide greater granularity and reduces the query latency by scanning relevant data partitions instead of the whole dataset.
Q14). How will you define the dynamic partitioning in Hive and when is it required?
In dynamic partitioning, values for partition columns are known in the real-time or we can say values are identified when data is loaded into a Hive table. Here are two possible situations when dynamic partitioning can be used on priority.
- When loading data from an existing non-partitioned table to improve the sampling and decrease the overall latency.
- When someone doesn’t know the value of partitions, calculating values for these partitions could be a tedious task. So, this would be a great idea opting for dynamic partitions here.
Q15). How many dynamic partitions can be created by a mapper or reducer in Hive? How can you change the default length?
By default, a maximum number of partitions that can be created by a mapper or reducer include 100. Once can change this default count by writing the following command –
SET hive.exec.max.dynamic.partitions.pernode =<value>
You can set a limit yourself in maximum values of dynamic partitions with the command given below.
SET hive.exec.max.dynamic.partitions = <value>
I hope you find this blog for Apache Hive Interview Questions and Answers relevant for you. You may check our other related blogs too like Hadoop Interview Questions, HDFS interview questions and more. We wish you luck with your next interview!