private static boolean partitionDiscoveryEnabled(Map<String, String> params) {
    return params != null && params.containsKey(DISCOVER_PARTITIONS_TBLPROPERTY) &&
            params.get(DISCOVER_PARTITIONS_TBLPROPERTY).equalsIgnoreCase("true");
  }
Partition management task is primarily responsible for partition retention and discovery based on table properties.

Partition Retention - If "partition.retention.period" table property is set with retention interval, when this
metastore task runs periodically, it will drop partitions with age (creation time) greater than retention period.
Dropping partitions after retention period will also delete the data in that partition.

Partition Discovery - If "discover.partitions" table property is set, this metastore task monitors table location
for newly added partition directories and create partition objects if it does not exist. Also, if partition object
exist and if corresponding directory does not exists under table location then the partition object will be dropped.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PartitionManagementTask.java