Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Count Number of Columns In Hive

I am looking for a way to count the number of columns in a table in Hive.

I know the following code works in Microsoft SQL Server. Is there a Hive equivalent?

SELECT COUNT(*),
  FROM INFORMATION_SCHEMA.COLUMNS
 WHERE TABLE_CATALOG = 'database_name'
   AND TABLE_SCHEMA = 'schema_name'
   AND TABLE_NAME = 'table_name'
like image 657
Gyan Veda Avatar asked Dec 16 '13 16:12

Gyan Veda


1 Answers

Try this

SHOW COLUMNS (FROM|IN) table_name [(FROM|IN) db_name]
like image 62
Sied Zarrinsaray Avatar answered Sep 28 '22 03:09

Sied Zarrinsaray