public synchronized void refreshTableByEvent(HiveTable updatedHiveTable, HiveCommonStats commonStats, Partition partition) {
        String dbName = updatedHiveTable.getDbName();
        String tableName = updatedHiveTable.getTableName();
        DatabaseTableName databaseTableName = DatabaseTableName.of(dbName, tableName);
        tableCache.put(databaseTableName, updatedHiveTable);
        if (updatedHiveTable.isUnPartitioned()) {
            Map<String, HiveColumnStats> columnStats = get(tableStatsCache, databaseTableName).getColumnStats();
            HivePartitionStats updatedPartitionStats = createPartitionStats(commonStats, columnStats);
            tableStatsCache.put(databaseTableName, updatedPartitionStats);
            partitionCache.put(HivePartitionName.of(dbName, tableName, Lists.newArrayList()), partition);
        } else {
            partitionKeysCache.asMap().keySet().stream().filter(hivePartitionValue -> hivePartitionValue.getHiveTableName().
                    equals(databaseTableName)).forEach(partitionKeysCache::invalidate);
            List<HivePartitionName> presentPartitions = getPresentPartitionNames(partitionCache, dbName, tableName);
            presentPartitions.forEach(p -> partitionCache.invalidate(p));
            List<HivePartitionName> presentPartitionStats = getPresentPartitionNames(partitionStatsCache, dbName, tableName);
            presentPartitionStats.forEach(p -> partitionStatsCache.invalidate(p));
        }
    }
@Test
    public void testRefreshTableByEvent() {
        CachingHiveMetastore cachingHiveMetastore = new CachingHiveMetastore(
                metastore, executor, expireAfterWriteSec, refreshAfterWriteSec, 1000, false);

        HiveCommonStats stats = new HiveCommonStats(10, 100);

        // unpartition
        {
            HiveTable table = (HiveTable) cachingHiveMetastore.getTable("db1", "tbl1");
            Partition partition = cachingHiveMetastore.getPartition(
                    "db1", "tbl1", Lists.newArrayList("par1"));
            cachingHiveMetastore.refreshTableByEvent(table, stats, partition);
        }

        // partition
        {
            HiveTable table = (HiveTable) cachingHiveMetastore.getTable("db1", "unpartitioned_table");
            Partition partition = cachingHiveMetastore.getPartition(
                    "db1", "unpartitioned_table", Lists.newArrayList("col1"));
            cachingHiveMetastore.refreshTableByEvent(table, stats, partition);
        }
    }