You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Paul Ingles <pa...@oobaloo.co.uk> on 2010/03/16 10:14:43 UTC

Check if partition exists

Hi,

I've had a look through the Wiki but couldn't see anything- is there a good (performant) way to check whether a partition exists for a table?

For example, let's say I have a table that stores Ad Impressions and these are partitioned for various countries/regions and by date. We have some other applications that consume data from Hive and I'd like to check that the data's been loaded before we attempt to run anything (that way we can defer for a few minutes and check again later).

I was wondering whether there was anything like a SELECT PARTITIONS FROM table_name WHERE region = 'us' and dated = '2010-01-01' that I could use, or, whether some other statement would avoid kicking off a MapReduce job.

Thanks,
Paul

Re: Check if partition exists

Posted by 김영우 <wa...@gmail.com>.
Hi Paul,

I believe you can use a 'SHOW PARTITIONS' statement. See details,
http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL#Show_Partitions

-Youngwoo

2010/3/16 Paul Ingles <pa...@oobaloo.co.uk>

> Hi,
>
> I've had a look through the Wiki but couldn't see anything- is there a good
> (performant) way to check whether a partition exists for a table?
>
> For example, let's say I have a table that stores Ad Impressions and these
> are partitioned for various countries/regions and by date. We have some
> other applications that consume data from Hive and I'd like to check that
> the data's been loaded before we attempt to run anything (that way we can
> defer for a few minutes and check again later).
>
> I was wondering whether there was anything like a SELECT PARTITIONS FROM
> table_name WHERE region = 'us' and dated = '2010-01-01' that I could use,
> or, whether some other statement would avoid kicking off a MapReduce job.
>
> Thanks,
> Paul