Hive interview questions - 4

19. Can a table be renamed in Hive?
Alter Table table_name RENAME TO new_name
ALTER TABLE log_messages RENAME TO logmsgs;

20. Can we change the data type of a column in a hive table?
Using REPLACE column option
ALTER TABLE table_name REPLACE COLUMNS ……
ALTER TABLE log_messages REPLACE COLUMNS (
hours_mins_secs INT COMMENT 'hour, minute, seconds from timestamp',
severity STRING COMMENT 'The message severity'
message STRING COMMENT 'The rest of the message');

21. What is a metastore in Hive?
It is a relational database storing the metadata of hive tables, partitions, Hive databases etc.

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

12345678910