hadoophivehiveqlbeelinehive-partitions

How to get whether the table is partitioned by dynamic or static in hive


Trying to find the list of tables have the dynamic partition in hive , Tried the following command and not getting the clue to find the way,

Commands tried

show partitions <table_name>
describe formatted <table_name>

Solution

  • There is no difference between dynamic and static partitions. This is how partitions were created. Dynamic - means partitions were created using insert overwrite table partition (partition_column) select ... statement (without partition value specified) execution.

    Static means that partitions were created using alter table add partition... statement or using the same insert overwrite table partition (partition_column='static value') statement . There is no such attribute in metadata because there is no difference between partitions created using INSERT (dynamic or static) or ALTER (static). It's possible to create partitions dynamically in table in which partitions were already created statically and vice-versa, absolutely no difference.

    Also you can add partitions using ALTER TABLE RECOVER PARTITIONS., partitions created by this statement are the same partitions, impossible to differentiate from partitions created by other means.