Support Questions

Find answers, ask questions, and share your expertise

Does Hive metadata store column names of a table?

avatar
New Contributor

Hi everyone,

I´m new using Hive and I may make some stupid cuestions.

I was trying to add some column names to a dataset (.txt) creating a new table in Hive and specifying wich data goes with wich column name.

The creation of the table is correct but when I use H2O to visualizate that data, the column names disappear.

How can call to the data stored with the column names?

thank you

5 REPLIES 5

avatar

Did you verify the data by viewing this data using beeline on the cluster? Does it show up correctly lining up under the expected columns when you do a select * from <tablename>. You can run desc [extended|formatted] <tablename> to view the metadata for the table.

avatar
New Contributor

Hi, sorry for the delay and thank you for the answer. When I do select * from <tablename> it doesn´t appear any column name but when I run desc extended <tablename> the appear. which one shows me if the column names are or not in the metadata?

thank you

avatar

desc <tablename> shows the table definition (including column names with the datatype) while select * from <tablename> shows the data in the table.

avatar
Expert Contributor

The hive table column names are stored in the metastore. Assuming you are using an external hive table on the txt file(s) you will need to either update the DDL for the table, or drop and re-create the table with the correct columns. Dropping an external table does not delete the underlying data.

avatar
Rising Star

Yes, metadata does store the columns name in its database.

hive > show columns in table_name:

hive> set hive.cli.print.header=true;

To view the column names of your table.