Hive external table not showing partitions

2.3k views Asked by At

I have created an external table using Hive. My

hive> desc <table_name>;

shows the following output:

OK
transactiontype         string                                      
transactionid           int                                         
sourcenumber            int                                         
destnumber              int                                         
amount                  int                                         
assumedfield1           int                                         
transactionstatus       string                                      
assumedfield2           int                                         
assumedfield3           int                                         
transactiondate         date                                        
customerid              int                                         

# Partition Information      
# col_name              data_type               comment             

  transactiondate       date                                        
  customerid            int                                         
  Time taken: 0.094 seconds, Fetched: 17 row(s)

But when I execute the following command:

hive> show partitions <dbname.tablename>;
OK
Time taken: 0.11 seconds

No partitions are shown. What might be the problem? When i see the hive.log, data in the table seems to be paritioned properly according to the 'transactiondate' and the 'customerid' fields. What is the max number of partitions that a single node should have? I have set 1000 partitions.

2015-06-15 10:33:44,713 INFO  [LocalJobRunner Map Task Executor #0]:       exec.FileSinkOperator (FileSinkOperator.java:createBucketForFileIdx(593)) - Writing to temp file: FS hdfs://localhost:54310/home/deepak/mobile_money_jan.txt/.hive-staging_hive_2015-06-15_10-30-53_308_5507019849041735537-1/_task_tmp.-ext-10002/transactiondate=2015-01-16/customerid=34560544/_tmp.000002_0

I am running hive on a single node hadoop cluster.

2

There are 2 answers

0
Selvaram G On

Try adding partitions manually

> alter table db.table add IF NOT EXISTS
> partition(datadate='2017-01-01') location
>'hdfs_location/datadate=2017-01-01'
0
Vishal Jadiya On

HI whenever we create an external table it's location is changed to a specified location in HIVE METADATA,it means now this changes reflects in hive meta store too. BUT the partition information remain unchanged ,partition information is not updated in hive meta store so we need to add those partitions manually.

ALTER TABLE "your-table" ADD PARTITION(transactiondate='datevalue',customerid='id-value');