Code review comment: The pattern of lock should be: ``` olapTable.writeLock(); try {    ...... } finally {     olapTable.writeUnlock(); }

Code under review:
public void modifyDefaultDistributionBucketNum(Database db, OlapTable olapTable, ModifyDistributionClause modifyDistributionClause) throws DdlException {
        olapTable.writeLock();

        if (olapTable.isColocateTable()) {
            throw new DdlException("Cannot change default bucket number of colocate table.");
        }

        if (olapTable.getPartitionInfo().getType() != PartitionType.RANGE) {
            throw new DdlException("Only support change partitioned table's distribution.");
        }

        DistributionInfo defaultDistributionInfo = olapTable.getDefaultDistributionInfo();
        if(defaultDistributionInfo.getType() != DistributionInfoType.HASH) {
            throw new DdlException("Cannot change default bucket number of distribution type " + defaultDistributionInfo.getType());
        }

        DistributionDesc distributionDesc = modifyDistributionClause.getDistributionDesc();

        DistributionInfo distributionInfo = null;

        List<Column> baseSchema = olapTable.getBaseSchema();

        if (distributionDesc != null) {
            distributionInfo = distributionDesc.toDistributionInfo(baseSchema);
                
            if (distributionInfo.getType() != DistributionInfoType.HASH) {
                throw new DdlException("Cannot change distribution type to " + distributionInfo.getType());
            }

            HashDistributionInfo hashDistributionInfo = (HashDistributionInfo) distributionInfo;
            List<Column> newDistriCols = hashDistributionInfo.getDistributionColumns();
            List<Column> defaultDistriCols = ((HashDistributionInfo) defaultDistributionInfo).getDistributionColumns();
            if (!newDistriCols.equals(defaultDistriCols)) {
                throw new DdlException("Cannot assign hash distribution with different distribution cols. "
                            + "default is: " + defaultDistriCols);
            }

            int bucketNum = hashDistributionInfo.getBucketNum();
            if (bucketNum <= 0) {
                throw new DdlException("Cannot assign hash distribution buckets less than 1");
            }

            defaultDistributionInfo.setBucketNum(bucketNum);

            ModifyTableDefaultDistributionBucketNumOperationLog info = new ModifyTableDefaultDistributionBucketNumOperationLog(db.getId(), olapTable.getId(), bucketNum);
            editLog.logModifyDefaultDistributionBucketNum(info);
            LOG.info("modify table[{}] default bucket num to {}", olapTable.getName(), bucketNum);
        }
        olapTable.writeUnlock();

    }

Line commented on: throw new DdlException("Cannot assign hash distribution with different distribution cols. "

Revised code:
public void modifyDefaultDistributionBucketNum(Database db, OlapTable olapTable, ModifyDistributionClause modifyDistributionClause) throws DdlException {
        olapTable.writeLock();

        try {
            if (olapTable.isColocateTable()) {
                throw new DdlException("Cannot change default bucket number of colocate table.");
            }
    
            if (olapTable.getPartitionInfo().getType() != PartitionType.RANGE) {
                throw new DdlException("Only support change partitioned table's distribution.");
            }
    
            DistributionInfo defaultDistributionInfo = olapTable.getDefaultDistributionInfo();
            if (defaultDistributionInfo.getType() != DistributionInfoType.HASH) {
                throw new DdlException("Cannot change default bucket number of distribution type " + defaultDistributionInfo.getType());
            }
    
            DistributionDesc distributionDesc = modifyDistributionClause.getDistributionDesc();
    
            DistributionInfo distributionInfo = null;
    
            List<Column> baseSchema = olapTable.getBaseSchema();
    
            if (distributionDesc != null) {
                distributionInfo = distributionDesc.toDistributionInfo(baseSchema);
                    
                if (distributionInfo.getType() != DistributionInfoType.HASH) {
                    throw new DdlException("Cannot change distribution type to " + distributionInfo.getType());
                }
    
                HashDistributionInfo hashDistributionInfo = (HashDistributionInfo) distributionInfo;
                List<Column> newDistriCols = hashDistributionInfo.getDistributionColumns();
                List<Column> defaultDistriCols = ((HashDistributionInfo) defaultDistributionInfo).getDistributionColumns();
                if (!newDistriCols.equals(defaultDistriCols)) {
                    throw new DdlException("Cannot assign hash distribution with different distribution cols. "
                                + "default is: " + defaultDistriCols);
                }
    
                int bucketNum = hashDistributionInfo.getBucketNum();
                if (bucketNum <= 0) {
                    throw new DdlException("Cannot assign hash distribution buckets less than 1");
                }
    
                defaultDistributionInfo.setBucketNum(bucketNum);
    
                ModifyTableDefaultDistributionBucketNumOperationLog info = new ModifyTableDefaultDistributionBucketNumOperationLog(db.getId(), olapTable.getId(), bucketNum);
                editLog.logModifyDefaultDistributionBucketNum(info);
                LOG.info("modify table[{}] default bucket num to {}", olapTable.getName(), bucketNum);
            }
        } finally {
            olapTable.writeUnlock();
        }
    }