hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Nastetsky <>
Subject Re: metastore join TBLS to COLUMNS_V2
Date Mon, 25 Aug 2014 16:35:59 GMT
Figured it out (actually by doing the same type of stuff on the metastore
itself, using the information_schema database).

For example, to see which tables have a column called "some_column_name" in
database "some_database", do the following:

select t.tbl_name
from DBS d
join TBLS t
  on d.db_id=t.db_id
join SDS s
  on t.sd_id=s.sd_id
join COLUMNS_V2 c
  on s.cd_id=c.cd_id
and c.column_name="some_column_name";

On Mon, Aug 25, 2014 at 12:15 PM, Alex Nastetsky <>

> Hi,
> I am trying to run some queries against the metastore, but I am not sure
> how to query the list of Hive columns in the COLUMNS_V2 table for a
> specific Hive table in the TBLS table.
> I want to do something like
> select t.tbl_name, c.column_name
> from TBLS t
> join COLUMNS c
> on t.tbl_id = ...
> I tried the cd_id field on the COLUMNS_V2 table but it didn't match up.
> I'm not sure if there's an intermediate table that needs to be involved or
> something else I am missing.
> Thanks!

View raw message