public void alterTableProperties(Database db, OlapTable table, Map<String, String> properties)
            throws DdlException {
        Map<String, String> propertiesToPersist = new HashMap<>(properties);
        Map<String, Object> results = validateToBeModifiedProps(properties, table);

        TableProperty tableProperty = table.getTableProperty();
        for (String key : results.keySet()) {
            if (propertiesToPersist.containsKey(PropertyAnalyzer.PROPERTIES_PARTITION_LIVE_NUMBER)) {
                int partitionLiveNumber = (int) results.get(key);
                tableProperty.getProperties().put(PropertyAnalyzer.PROPERTIES_PARTITION_LIVE_NUMBER,
                        String.valueOf(partitionLiveNumber));
                if (partitionLiveNumber == TableProperty.INVALID) {
                    GlobalStateMgr.getCurrentState().getDynamicPartitionScheduler().removeTtlPartitionTable(db.getId(),
                            table.getId());
                } else {
                    GlobalStateMgr.getCurrentState().getDynamicPartitionScheduler().registerTtlPartitionTable(db.getId(),
                            table.getId());
                }
                tableProperty.setPartitionTTLNumber(partitionLiveNumber);
                ModifyTablePropertyOperationLog info =
                        new ModifyTablePropertyOperationLog(db.getId(), table.getId(),
                                ImmutableMap.of(key, propertiesToPersist.get(key)));
                GlobalStateMgr.getCurrentState().getEditLog().logAlterTableProperties(info);
            }
            if (propertiesToPersist.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_MEDIUM)) {
                DataProperty dataProperty = (DataProperty) results.get(key);
                TStorageMedium storageMedium = dataProperty.getStorageMedium();
                table.setStorageMedium(storageMedium);
                tableProperty.getProperties()
                        .put(PropertyAnalyzer.PROPERTIES_STORAGE_COOLDOWN_TIME,
                                String.valueOf(dataProperty.getCooldownTimeMs()));
                ModifyTablePropertyOperationLog info =
                        new ModifyTablePropertyOperationLog(db.getId(), table.getId(),
                                ImmutableMap.of(key, propertiesToPersist.get(key)));
                GlobalStateMgr.getCurrentState().getEditLog().logAlterTableProperties(info);
            }
            if (propertiesToPersist.containsKey(PropertyAnalyzer.PROPERTIES_STORAGE_COOLDOWN_TTL)) {
                String storageCoolDownTTL = propertiesToPersist.get(PropertyAnalyzer.PROPERTIES_STORAGE_COOLDOWN_TTL);
                tableProperty.getProperties().put(PropertyAnalyzer.PROPERTIES_STORAGE_COOLDOWN_TTL, storageCoolDownTTL);
                tableProperty.buildStorageCoolDownTTL();
                ModifyTablePropertyOperationLog info =
                        new ModifyTablePropertyOperationLog(db.getId(), table.getId(),
                                ImmutableMap.of(key, propertiesToPersist.get(key)));
                GlobalStateMgr.getCurrentState().getEditLog().logAlterTableProperties(info);
            }
            if (propertiesToPersist.containsKey(PropertyAnalyzer.PROPERTIES_DATACACHE_PARTITION_DURATION)) {
                String partitionDuration = propertiesToPersist.get(PropertyAnalyzer.PROPERTIES_DATACACHE_PARTITION_DURATION);
                tableProperty.getProperties().put(PropertyAnalyzer.PROPERTIES_DATACACHE_PARTITION_DURATION, partitionDuration);
                tableProperty.buildDataCachePartitionDuration();
                ModifyTablePropertyOperationLog info =
                        new ModifyTablePropertyOperationLog(db.getId(), table.getId(),
                                ImmutableMap.of(key, propertiesToPersist.get(key)));
                GlobalStateMgr.getCurrentState().getEditLog().logAlterTableProperties(info);
            }
            if (propertiesToPersist.containsKey(PropertyAnalyzer.PROPERTIES_LABELS_LOCATION)) {
                String location = propertiesToPersist.get(PropertyAnalyzer.PROPERTIES_LABELS_LOCATION);
                table.setLocation(location);
                ModifyTablePropertyOperationLog info =
                        new ModifyTablePropertyOperationLog(db.getId(), table.getId(),
                                ImmutableMap.of(key, propertiesToPersist.get(key)));
                GlobalStateMgr.getCurrentState().getEditLog().logAlterTableProperties(info);
            }
        }
    }
@Test
    public void testAlterTableProperties() throws Exception {
        Database db = connectContext.getGlobalStateMgr().getDb("test");
        OlapTable table = (OlapTable) db.getTable("t1");

        Map<String, String> properties = Maps.newHashMap();
        properties.put(PropertyAnalyzer.PROPERTIES_DATACACHE_PARTITION_DURATION, "abcd");
        LocalMetastore localMetastore = connectContext.getGlobalStateMgr().getLocalMetastore();
        try {
            localMetastore.alterTableProperties(db, table, properties);
        } catch (RuntimeException e) {
            Assert.assertEquals("Cannot parse text to Duration", e.getMessage());
        }
    }