Hive interview questions

Hive @ Freshers.in

22. 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. A SerDe allows Hive to read in data from a table, and write it back out to HDFS in any custom format

23. Why do we need Hive?
Hive is a tool in Hadoop ecosystem which provides an interface to organize and query data in a database like fashion and write SQL like queries. It is suitable for accessing and analyzing data in Hadoop using SQL syntax.

24. What is the default location where hive stores table data?
hdfs://namenode_server/user/ hive/warehouse

25. What are the three different modes in which hive can be run ?
Local mode
Distributed mode
Pseudodistributed mode

26. Is there a date data type in Hive ?
Yes. The TIMESTAMP data types stores date in java.sql.timestamp format
Strings: JDBC compliant java.sql.Timestamp format “YYYY-MM-DD HH:MM:SS.fffffffff” (9 decimal place precision)

27. What are collection data types in Hive ?
There are three collection data types in Hive.
ARRAY
MAP
STRUCT
example :
CREATE TABLE employees (
name STRING,
salary FLOAT,
subordinates ARRAY<STRING>,
deductions MAP<STRING, FLOAT>,
address STRUCT<street:STRING, city:STRING, state:STRING, zip:INT>
)
ROW FORMAT DELIMITED

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

Author: user

Leave a Reply