如何将数据库中的表的纯计数作为输出-将表中的列的纯计数作为输出
3hvapo4f1#
你可以从 metastore database :
metastore database
hive=> SELECT "TBL_NAME", "COLUMN_NAME", "TYPE_NAME" FROM "TBLS" , "COLUMNS_V2" WHERE "TBL_ID"="CD_ID" UNION SELECT "TBL_NAME", "PKEY_NAME", "PKEY_TYPE" FROM "PARTITION_KEYS" p , "TBLS" t WHERE p."TBL_ID"=t."TBL_ID" ORDER BY "TBL_NAME"; TBL_NAME | COLUMN_NAME | TYPE_NAME ------------+-------------+----------- tableA | aaa | string tableA | bbb | string tableB | foo | string tableB | bar | int tableC | cola | string tableD | colb | string (6 rows)
如果这有帮助,请告诉我。
42fyovps2#
hive> select count(column_name) as NoOfColumns from information_schema.columns where table_name= "TableName"; hive> select count(table_name) as NoOfTables from information_schema.tables;
更多详情:点击这里
2条答案
按热度按时间3hvapo4f1#
你可以从
metastore database
:如果这有帮助,请告诉我。
42fyovps2#
更多详情:点击这里