Top Most Apache Hive Interview Questions
What Are The Different Types Of Tables Available In Hive?
There are two types. Managed table and external table. In managed table both the data an schema in under control of hive but in external table only the schema is under control of Hive.
Is Hive Suitable To Be Used For Oltp Systems? Why?
No Hive does not provide insert and update at row level. So it is not suitable for OLTP system.
Can A Table Be Renamed In Hive?
Alter Table table_name RENAME TO new_name
Can We Change The Data Type Of A Column In A Hive Table?
Using REPLACE column option
ALTER TABLE table_name REPLACE COLUMNS ……
What Is A Metastore In Hive?
It is a relational database storing the metadata of hive tables, partitions, Hive databases etc
What Is The Need For Custom Serde?
Depending on the nature of data the user has, the inbuilt SerDe may not satisfy the format of the data. SO users need to write their own java code to satisfy their data format requirements.
Why Do We Need Hive?
Hive is a tool in Hadoop ecosystem which provides an interface to organize and query data in a databse like fashion and write SQL like queries. It is suitable for accessing and analyzing data in Hadoop using SQL syntax.
What Is The Default Location Where Hive Stores Table Data?
hdfs://namenode_server/user/hive/warehouse
What Are The Three Different Modes In Which Hive Can Be Run?
Local mode
Distributed mode
Pseudodistributed mode
Is There A Date Data Type In Hive?
Yes. The TIMESTAMP data types stores date in java.sql.timestamp format
What Are Collection Data Types In Hive?
There are three collection data types in Hive.
ARRAY
MAP
STRUCT
Can We Run Unix Shell Commands From Hive? Give Example?
Yes, using the ! mark just before the command.
For example !pwd at hive prompt will list the current directory.
What Is A Hive Variable? What For We Use It?
The hive variable is variable created in the Hive environment that can be referenced by Hive scripts. It is used to pass some values to the hive queries when the query starts executing.
Can Hive Queries Be Executed From Script Files? How?
Using the source command.
Example:
Hive> source /path/to/file/file_with_query.hql
What Is The Importance Of .hiverc File?
It is a file containing list of commands needs to run when the hive CLI starts. For example setting the strict mode to be true etc.
What Are The Default Record And Field Delimiter Used For Hive Text Files?
The default record delimiter is − n
And the filed delimiters are − 01,02,03
What Do You Mean By Schema On Read?
The schema is validated with the data when reading the data and not enforced when writing data.
How Do You List All Databases Whose Name Starts With P?
SHOW DATABASES LIKE ‘p.*’