You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Devopam Mittra <de...@gmail.com> on 2014/08/01 06:00:59 UTC

Re: How can I know one table is a partitioned table in hive?

If you have mySQL as your metastore , you may use something similar to
below:

SELECT tbl.TBL_NAME,COUNT(DISTINCT part.PART_NAME) AS partition_count
FROM metastore_db.TBLS tbl, metastore_db.PARTITIONS part
WHERE tbl.TBL_ID = part.TBL_ID
AND tbl.TBL_TYPE = 'MANAGED_TABLE'
GROUP BY tbl.TBL_NAME;

Do remember to change the db name to yours before testing it out :)
regards
Dev



On Thu, Jul 31, 2014 at 6:34 PM, Dan Fan <df...@appnexus.com> wrote:

>  The easiest way is to go to hive,
> Show create table table_name.
> Then you can know when the table, if the it is partitioned
>
>   From: Nitin Pawar <ni...@gmail.com>
> Reply-To: "user@hive.apache.org" <us...@hive.apache.org>
> Date: Thursday, July 31, 2014 at 3:50 AM
> To: "user@hive.apache.org" <us...@hive.apache.org>
> Subject: Re: How can I know one table is a partitioned table in hive?
>
>   what are the options you have?
> can you write a java code which can interact with hcatalog ?
> or you can do a describle table and check for partion column details in
> there
>
>
> On Thu, Jul 31, 2014 at 1:11 PM, 张甲超 <re...@gmail.com> wrote:
>
>> dear all,
>>         I want know that one table is a partitioned table in hive, and
>> return the result to shell.
>>         How can I do?
>>
>
>
>
>  --
> Nitin Pawar
>



-- 
Devopam Mittra
Life and Relations are not binary

Re: How can I know one table is a partitioned table in hive?

Posted by 张甲超 <re...@gmail.com>.
thanks

在 2014年08月01日 12:00, Devopam Mittra 写道:
> If you have mySQL as your metastore , you may use something similar to 
> below:
>
> SELECT tbl.TBL_NAME,COUNT(DISTINCT part.PART_NAME) AS partition_count
> FROM metastore_db.TBLS tbl, metastore_db.PARTITIONS part
> WHERE tbl.TBL_ID = part.TBL_ID
> AND tbl.TBL_TYPE = 'MANAGED_TABLE'
> GROUP BY tbl.TBL_NAME;
>
> Do remember to change the db name to yours before testing it out :)
> regards
> Dev
>
>
>
> On Thu, Jul 31, 2014 at 6:34 PM, Dan Fan <dfan@appnexus.com 
> <ma...@appnexus.com>> wrote:
>
>     The easiest way is to go to hive,
>     Show create table table_name.
>     Then you can know when the table, if the it is partitioned
>
>     From: Nitin Pawar <nitinpawar432@gmail.com
>     <ma...@gmail.com>>
>     Reply-To: "user@hive.apache.org <ma...@hive.apache.org>"
>     <user@hive.apache.org <ma...@hive.apache.org>>
>     Date: Thursday, July 31, 2014 at 3:50 AM
>     To: "user@hive.apache.org <ma...@hive.apache.org>"
>     <user@hive.apache.org <ma...@hive.apache.org>>
>     Subject: Re: How can I know one table is a partitioned table in hive?
>
>     what are the options you have?
>     can you write a java code which can interact with hcatalog ?
>     or you can do a describle table and check for partion column
>     details in there
>
>
>     On Thu, Jul 31, 2014 at 1:11 PM, 张甲超 <rebeyond1218@gmail.com
>     <ma...@gmail.com>> wrote:
>
>         dear all,
>                 I want know that one table is a partitioned table in
>         hive, and return the result to shell.
>                 How can I do?
>
>
>
>
>     -- 
>     Nitin Pawar
>
>
>
>
> -- 
> Devopam Mittra
> Life and Relations are not binary


Re: How can I know one table is a partitioned table in hive?

Posted by Krishnan Narayanan <kr...@gmail.com>.
>From shell You can do hive -e "use DB name; show partitions tablename" >>
filename.txt


On Thu, Jul 31, 2014 at 9:00 PM, Devopam Mittra <de...@gmail.com> wrote:

> If you have mySQL as your metastore , you may use something similar to
> below:
>
> SELECT tbl.TBL_NAME,COUNT(DISTINCT part.PART_NAME) AS partition_count
> FROM metastore_db.TBLS tbl, metastore_db.PARTITIONS part
> WHERE tbl.TBL_ID = part.TBL_ID
> AND tbl.TBL_TYPE = 'MANAGED_TABLE'
> GROUP BY tbl.TBL_NAME;
>
> Do remember to change the db name to yours before testing it out :)
> regards
> Dev
>
>
>
> On Thu, Jul 31, 2014 at 6:34 PM, Dan Fan <df...@appnexus.com> wrote:
>
>>  The easiest way is to go to hive,
>> Show create table table_name.
>> Then you can know when the table, if the it is partitioned
>>
>>   From: Nitin Pawar <ni...@gmail.com>
>> Reply-To: "user@hive.apache.org" <us...@hive.apache.org>
>> Date: Thursday, July 31, 2014 at 3:50 AM
>> To: "user@hive.apache.org" <us...@hive.apache.org>
>> Subject: Re: How can I know one table is a partitioned table in hive?
>>
>>   what are the options you have?
>> can you write a java code which can interact with hcatalog ?
>> or you can do a describle table and check for partion column details in
>> there
>>
>>
>> On Thu, Jul 31, 2014 at 1:11 PM, 张甲超 <re...@gmail.com> wrote:
>>
>>> dear all,
>>>         I want know that one table is a partitioned table in hive, and
>>> return the result to shell.
>>>         How can I do?
>>>
>>
>>
>>
>>  --
>> Nitin Pawar
>>
>
>
>
> --
> Devopam Mittra
> Life and Relations are not binary
>