Created
October 28, 2020 10:07
-
-
Save sankars/71a9887d0c4a4caa77d5175ea868e965 to your computer and use it in GitHub Desktop.
hive table metadata with row and column count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT d.NAME AS DB_NAME, t. TBL_NAME, COUNT(1) AS COL_COUNT, tp.PARAM_VALUE AS ROW_COUNT | |
FROM hive.TBLS t | |
JOIN hive.DBS d | |
ON t.DB_ID = d.DB_ID | |
JOIN hive.SDS s | |
ON t.SD_ID = s.SD_ID | |
JOIN hive.COLUMNS_V2 c | |
ON s.CD_ID = c.CD_ID | |
JOIN hive.TABLE_PARAMS tp | |
ON t.TBL_ID = tp.TBL_ID | |
WHERE tp.PARAM_KEY = 'numRows' | |
GROUP BY d.NAME, t.TBL_NAME | |
ORDER BY d.NAME, t.TBL_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment