How to list all the columns in a Hive table? - Big Data In Real World

How to list all the columns in a Hive table?

What is the difference between partitioning and bucketing a table in Hive?
September 20, 2021
Why do I see 200 tasks in Spark execution?
September 24, 2021
What is the difference between partitioning and bucketing a table in Hive?
September 20, 2021
Why do I see 200 tasks in Spark execution?
September 24, 2021

Sometimes you would have a need to list all the columns in a table. You can do this pretty easily if you are using a RDBMS like Oracle or SQL Server using Toad or SQL Management Studio respectively. There are a couple of ways to list all the columns in a Hive table. 

Solution

You can do describe formatted on a table to get all the information about the table and it will look like below. The problem is it will list all the details behind the table along with the column names.

 

describe formatted Hive

If you need just the column names, you can execute show columns in <table name>

0: jdbc:hive2://ms2.hirw.com:2181,wk1.hirw.co> show columns in employee;

+---------+--+
|  field  |
+---------+--+
| eid     |
| name    |
| salary  |
+---------+--+

3 rows selected (0.297 seconds)

 

Big Data In Real World
Big Data In Real World
We are a group of Big Data engineers who are passionate about Big Data and related Big Data technologies. We have designed, developed, deployed and maintained Big Data applications ranging from batch to real time streaming big data platforms. We have seen a wide range of real world big data problems, implemented some innovative and complex (or simple, depending on how you look at it) solutions.

Comments are closed.

How to list all the columns in a Hive table?
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.

Hadoop In Real World is now Big Data In Real World!

X