Hive查询分区元数据,PARTITIONED BY

-- 查询具体表的分区目录 
select t1.NAME, t2.TBL_NAME,t4.PART_NAME, t3.LOCATION from DBS t1, TBLS t2 , SDS t3 ,PARTITIONSt4 
where t1.DB_ID=t2.DB_ID and t4.SD_ID = t3.SD_ID AND t2.TBL_ID = t4.TBL_ID and t1.NAME` = '数据库名' AND
t2.TBL_NAME like '表名'

UNION

-- 查询具体表的目录
select t1.NAME, t2.TBL_NAME,'null', t3.LOCATION from DBS t1, TBLS t2 , SDS t3
where t1.DB_ID=t2.DB_ID and
t2.SD_ID = t3.SD_ID AND
t1.NAME = '数据库名' AND
t2.TBL_NAME like '表名' ;`

 

posted @ 2020-11-01 08:50  奇遇yms  阅读(2258)  评论(0编辑  收藏  举报