@Override
    public List<String> getPartitionKeysByValue(String dbName, String tableName, List<Optional<String>> partitionValues) {
        DatabaseTableName databaseTableName = DatabaseTableName.of(dbName, tableName);
        HivePartitionValue hivePartitionValue = HivePartitionValue.of(databaseTableName, partitionValues);
        if (metastore instanceof CachingHiveMetastore) {
            Table table = getTable(dbName, tableName);
            if (table.isHiveTable() && !((HiveTable) table).isUseMetadataCache()) {
                invalidatePartitionKeys(hivePartitionValue);
            }
        }
        // update last access time
        lastAccessTimeMap.put(databaseTableName, System.currentTimeMillis());
        // first check if the all partition keys are cached
        HivePartitionValue allPartitionValue = HivePartitionValue.of(databaseTableName, HivePartitionValue.ALL_PARTITION_VALUES);
        if (partitionKeysCache.asMap().containsKey(allPartitionValue)) {
            List<String> allPartitionNames = get(partitionKeysCache, allPartitionValue);
            if (partitionValues.stream().noneMatch(Optional::isPresent)) {
                // no need to filter partition names by values
                return allPartitionNames;
            }
            return PartitionUtil.getFilteredPartitionKeys(allPartitionNames, partitionValues);
        }
        return get(partitionKeysCache, hivePartitionValue);
    }
@Test
    public void testGetPartitionKeys() {
        CachingHiveMetastore cachingHiveMetastore = new CachingHiveMetastore(
                metastore, executor, expireAfterWriteSec, refreshAfterWriteSec, 1000, false);
        Assert.assertEquals(Lists.newArrayList("col1"), cachingHiveMetastore.getPartitionKeysByValue("db1", "tbl1",
                HivePartitionValue.ALL_PARTITION_VALUES));
    }