Code review comment: ```suggestion                 if (!engineName.equalsIgnoreCase("olap")) {                     throw new Exception;                 } ``` which can make code less indentation

Code under review:
public void analyze(Analyzer analyzer) throws UserException {
        super.analyze(analyzer);
        tableName.analyze(analyzer);
        FeNameFormat.checkTableName(tableName.getTbl());

        if (!Catalog.getCurrentCatalog().getAuth().checkTblPriv(ConnectContext.get(), tableName.getDb(),
                tableName.getTbl(), PrivPredicate.CREATE)) {
            ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "CREATE");
        }

        analyzeEngineName();

        
        if (!(engineName.equals("mysql") || engineName.equals("broker"))) {
            if (engineName.equals("kudu")) {
                if (keysDesc == null) {
                    throw new AnalysisException("create kudu table should contains keys desc");
                }
                KuduUtil.analyzeKeyDesc(keysDesc);
            } else {
                
                if (keysDesc == null) {
                    List<String> keysColumnNames = Lists.newArrayList();
                    int keyLength = 0;
                    boolean hasAggregate = false;
                    for (ColumnDef columnDef : columnDefs) {
                        if (columnDef.getAggregateType() != null) {
                            hasAggregate = true;
                            break;
                        }
                    }
                    if (hasAggregate) {
                        for (ColumnDef columnDef : columnDefs) {
                            if (columnDef.getAggregateType() == null) {
                                keysColumnNames.add(columnDef.getName());
                            }
                        }
                        keysDesc = new KeysDesc(KeysType.AGG_KEYS, keysColumnNames);
                    } else {
                        for (ColumnDef columnDef : columnDefs) {
                            keyLength += columnDef.getType().getStorageLayoutBytes();
                            if (keysColumnNames.size() < FeConstants.shortkey_max_column_count
                                    || keyLength < FeConstants.shortkey_maxsize_bytes) {
                                keysColumnNames.add(columnDef.getName());
                            }
                        }
                        keysDesc = new KeysDesc(KeysType.DUP_KEYS, keysColumnNames);
                    }
                }

                keysDesc.analyze(columnDefs);
                for (int i = 0; i < keysDesc.keysColumnSize(); ++i) {
                    columnDefs.get(i).setIsKey(true);
                }
                if (keysDesc.getKeysType() != KeysType.AGG_KEYS) {
                    AggregateType type = AggregateType.REPLACE;
                    if (keysDesc.getKeysType() == KeysType.DUP_KEYS) {
                        type = AggregateType.NONE;
                    }
                    for (int i = keysDesc.keysColumnSize(); i < columnDefs.size(); ++i) {
                        columnDefs.get(i).setAggregateType(type, true);
                    }
                }
            }
        } else {
            
            if (keysDesc != null) {
                throw new AnalysisException("Create " + engineName + " table should not contain keys desc");
            }

            for (ColumnDef columnDef : columnDefs) {
                columnDef.setIsKey(true);
            }
        }

        
        if (columnDefs == null || columnDefs.isEmpty()) {
            ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLE_MUST_HAVE_COLUMNS);
        }

        int rowLengthBytes = 0;
        boolean hasHll = false;
        boolean hasBitmap = false;
        Set<String> columnSet = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
        for (ColumnDef columnDef : columnDefs) {
            if (engineName.equals("kudu")) {
                
                throw new NotImplementedException("");
            } else {
                columnDef.analyze(engineName.equals("olap"));
            }

            if (columnDef.getType().isHllType()) {
                if (columnDef.isKey()) {
                    throw new AnalysisException("HLL can't be used as keys, " +
                            "please specify the aggregation type HLL_UNION");
                }
                hasHll = true;
            }

            if (columnDef.getType().isBitmapType()) {
                if (columnDef.isKey()) {
                    throw new AnalysisException("BITMAP can't be used as keys, ");
                }
            }

            if (columnDef.getAggregateType() == BITMAP_UNION) {
                if (columnDef.isKey()) {
                    throw new AnalysisException("Key column can't has the BITMAP_UNION aggregation type");
                }
                hasBitmap = true;
            }

            if (!columnSet.add(columnDef.getName())) {
                ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, columnDef.getName());
            }

            rowLengthBytes += columnDef.getType().getStorageLayoutBytes();
        }

        if (rowLengthBytes > Config.max_layout_length_per_row && engineName.equals("olap")) {
            throw new AnalysisException("The size of a row (" + rowLengthBytes + ") exceed the maximal row size: "
                    + Config.max_layout_length_per_row);
        }

        if (hasHll && keysDesc.getKeysType() != KeysType.AGG_KEYS) {
            throw new AnalysisException("HLL must be used in AGG_KEYS");
        }

        if (hasBitmap && keysDesc.getKeysType() != KeysType.AGG_KEYS) {
            throw new AnalysisException("BITMAP_UNION must be used in AGG_KEYS");
        }

        if (engineName.equals("olap")) {
            
            if (partitionDesc != null) {
                if (partitionDesc.getType() != PartitionType.RANGE) {
                    throw new AnalysisException("Currently only support range partition with engine type olap");
                }

                RangePartitionDesc rangePartitionDesc = (RangePartitionDesc) partitionDesc;
                rangePartitionDesc.analyze(columnDefs, properties);
            }

            
            if (distributionDesc == null) {
                throw new AnalysisException("Create olap table should contain distribution desc");
            }
            distributionDesc.analyze(columnSet);
        } else if (engineName.equals("kudu")) {
            KuduUtil.analyzePartitionAndDistributionDesc(keysDesc, partitionDesc, distributionDesc);
        } else if (engineName.equalsIgnoreCase("elasticsearch")) {
            EsUtil.analyzePartitionAndDistributionDesc(partitionDesc, distributionDesc);
        } else {
            if (partitionDesc != null || distributionDesc != null) {
                throw new AnalysisException("Create " + engineName
                        + " table should not contain partition or distribution desc");
            }
        }

        for (ColumnDef columnDef : columnDefs) {
            Column col = columnDef.toColumn();
            if (keysDesc != null && keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
                if (!col.isKey()) {
                    col.setAggregationTypeImplicit(true);
                }
            }
            columns.add(col);
        }

        if (CollectionUtils.isNotEmpty(indexDefs)) {
            Set<String> distinct = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
            Set<List<String>> distinctCol = new HashSet<>();

            for (IndexDef indexDef : indexDefs) {
                indexDef.analyze();
                if (engineName.equalsIgnoreCase("olap")) {
                    for (String indexColName : indexDef.getColumns()) {
                        indexColName = indexColName.trim();
                        boolean found = false;
                        for (Column column : columns) {
                            if (column.getName().equalsIgnoreCase(indexColName)) {
                                indexColName = column.getName();
                                PrimitiveType colType = column.getDataType();

                                
                                if (indexDef.getIndexType() == IndexDef.IndexType.BITMAP) {
                                    if (!(colType == PrimitiveType.TINYINT || colType == PrimitiveType.SMALLINT
                                                  || colType == PrimitiveType.INT || colType == PrimitiveType.BIGINT ||
                                                  colType == PrimitiveType.CHAR || colType == PrimitiveType.VARCHAR)) {
                                        throw new AnalysisException(colType + " is not supported in bitmap index. "
                                                + "invalid column: " + indexColName);
                                    } else if (column.isKey()
                                            || column.getAggregationType() == AggregateType.NONE
                                            || column.getAggregationType() == AggregateType.REPLACE
                                            || column.getAggregationType() == AggregateType.REPLACE_IF_NOT_NULL) {
                                        found = true;
                                        break;
                                    } else {
                                        
                                        
                                        throw new AnalysisException(
                                                "BITMAP index only used in columns of DUP_KEYS table or "
                                                        + "key columns of UNIQUE_KEYS/AGG_KEYS table. invalid column: "
                                                        + indexColName);
                                    }
                                }
                            }
                        }

                        if (!found) {
                            throw new AnalysisException("BITMAP column does not exist in table. invalid column: "
                                    + indexColName);
                        }
                    }
                } else {
                    throw new AnalysisException("index only support at current version");
                }

                indexes.add(new Index(indexDef.getIndexName(), indexDef.getColumns(), indexDef.getIndexType(),
                        indexDef.getComment()));
                distinct.add(indexDef.getIndexName());
                distinctCol.add(indexDef.getColumns().stream().map(String::toUpperCase).collect(Collectors.toList()));
            }
            if (distinct.size() != indexes.size()) {
                throw new AnalysisException("index name must be unique.");
            }
            if (distinctCol.size() != indexes.size()) {
                throw new AnalysisException("same index columns have multiple index name is not allowed.");
            }
        }
    }

Line commented on: if (engineName.equalsIgnoreCase("olap")) {

Revised code:
public void analyze(Analyzer analyzer) throws UserException {
        super.analyze(analyzer);
        tableName.analyze(analyzer);
        FeNameFormat.checkTableName(tableName.getTbl());

        if (!Catalog.getCurrentCatalog().getAuth().checkTblPriv(ConnectContext.get(), tableName.getDb(),
                tableName.getTbl(), PrivPredicate.CREATE)) {
            ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "CREATE");
        }

        analyzeEngineName();

        
        if (!(engineName.equals("mysql") || engineName.equals("broker"))) {
            if (engineName.equals("kudu")) {
                if (keysDesc == null) {
                    throw new AnalysisException("create kudu table should contains keys desc");
                }
                KuduUtil.analyzeKeyDesc(keysDesc);
            } else {
                
                if (keysDesc == null) {
                    List<String> keysColumnNames = Lists.newArrayList();
                    int keyLength = 0;
                    boolean hasAggregate = false;
                    for (ColumnDef columnDef : columnDefs) {
                        if (columnDef.getAggregateType() != null) {
                            hasAggregate = true;
                            break;
                        }
                    }
                    if (hasAggregate) {
                        for (ColumnDef columnDef : columnDefs) {
                            if (columnDef.getAggregateType() == null) {
                                keysColumnNames.add(columnDef.getName());
                            }
                        }
                        keysDesc = new KeysDesc(KeysType.AGG_KEYS, keysColumnNames);
                    } else {
                        for (ColumnDef columnDef : columnDefs) {
                            keyLength += columnDef.getType().getStorageLayoutBytes();
                            if (keysColumnNames.size() < FeConstants.shortkey_max_column_count
                                    || keyLength < FeConstants.shortkey_maxsize_bytes) {
                                keysColumnNames.add(columnDef.getName());
                            }
                        }
                        keysDesc = new KeysDesc(KeysType.DUP_KEYS, keysColumnNames);
                    }
                }

                keysDesc.analyze(columnDefs);
                for (int i = 0; i < keysDesc.keysColumnSize(); ++i) {
                    columnDefs.get(i).setIsKey(true);
                }
                if (keysDesc.getKeysType() != KeysType.AGG_KEYS) {
                    AggregateType type = AggregateType.REPLACE;
                    if (keysDesc.getKeysType() == KeysType.DUP_KEYS) {
                        type = AggregateType.NONE;
                    }
                    for (int i = keysDesc.keysColumnSize(); i < columnDefs.size(); ++i) {
                        columnDefs.get(i).setAggregateType(type, true);
                    }
                }
            }
        } else {
            
            if (keysDesc != null) {
                throw new AnalysisException("Create " + engineName + " table should not contain keys desc");
            }

            for (ColumnDef columnDef : columnDefs) {
                columnDef.setIsKey(true);
            }
        }

        
        if (columnDefs == null || columnDefs.isEmpty()) {
            ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLE_MUST_HAVE_COLUMNS);
        }

        int rowLengthBytes = 0;
        boolean hasHll = false;
        boolean hasBitmap = false;
        Set<String> columnSet = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
        for (ColumnDef columnDef : columnDefs) {
            if (engineName.equals("kudu")) {
                
                throw new NotImplementedException("");
            } else {
                columnDef.analyze(engineName.equals("olap"));
            }

            if (columnDef.getType().isHllType()) {
                if (columnDef.isKey()) {
                    throw new AnalysisException("HLL can't be used as keys, " +
                            "please specify the aggregation type HLL_UNION");
                }
                hasHll = true;
            }

            if (columnDef.getType().isBitmapType()) {
                if (columnDef.isKey()) {
                    throw new AnalysisException("BITMAP can't be used as keys, ");
                }
            }

            if (columnDef.getAggregateType() == BITMAP_UNION) {
                if (columnDef.isKey()) {
                    throw new AnalysisException("Key column can't has the BITMAP_UNION aggregation type");
                }
                hasBitmap = true;
            }

            if (!columnSet.add(columnDef.getName())) {
                ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, columnDef.getName());
            }

            rowLengthBytes += columnDef.getType().getStorageLayoutBytes();
        }

        if (rowLengthBytes > Config.max_layout_length_per_row && engineName.equals("olap")) {
            throw new AnalysisException("The size of a row (" + rowLengthBytes + ") exceed the maximal row size: "
                    + Config.max_layout_length_per_row);
        }

        if (hasHll && keysDesc.getKeysType() != KeysType.AGG_KEYS) {
            throw new AnalysisException("HLL must be used in AGG_KEYS");
        }

        if (hasBitmap && keysDesc.getKeysType() != KeysType.AGG_KEYS) {
            throw new AnalysisException("BITMAP_UNION must be used in AGG_KEYS");
        }

        if (engineName.equals("olap")) {
            
            if (partitionDesc != null) {
                if (partitionDesc.getType() != PartitionType.RANGE) {
                    throw new AnalysisException("Currently only support range partition with engine type olap");
                }

                RangePartitionDesc rangePartitionDesc = (RangePartitionDesc) partitionDesc;
                rangePartitionDesc.analyze(columnDefs, properties);
            }

            
            if (distributionDesc == null) {
                throw new AnalysisException("Create olap table should contain distribution desc");
            }
            distributionDesc.analyze(columnSet);
        } else if (engineName.equals("kudu")) {
            KuduUtil.analyzePartitionAndDistributionDesc(keysDesc, partitionDesc, distributionDesc);
        } else if (engineName.equalsIgnoreCase("elasticsearch")) {
            EsUtil.analyzePartitionAndDistributionDesc(partitionDesc, distributionDesc);
        } else {
            if (partitionDesc != null || distributionDesc != null) {
                throw new AnalysisException("Create " + engineName
                        + " table should not contain partition or distribution desc");
            }
        }

        for (ColumnDef columnDef : columnDefs) {
            Column col = columnDef.toColumn();
            if (keysDesc != null && keysDesc.getKeysType() == KeysType.UNIQUE_KEYS) {
                if (!col.isKey()) {
                    col.setAggregationTypeImplicit(true);
                }
            }
            columns.add(col);
        }

        if (CollectionUtils.isNotEmpty(indexDefs)) {
            Set<String> distinct = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
            Set<List<String>> distinctCol = new HashSet<>();

            for (IndexDef indexDef : indexDefs) {
                indexDef.analyze();
                if (!engineName.equalsIgnoreCase("olap")) {
                    throw new AnalysisException("index only support in olap engine at current version.");
                }
                for (String indexColName : indexDef.getColumns()) {
                    indexColName = indexColName.trim();
                    boolean found = false;
                    for (Column column : columns) {
                        if (column.getName().equalsIgnoreCase(indexColName)) {
                            indexColName = column.getName();
                            PrimitiveType colType = column.getDataType();

                            
                            if (indexDef.getIndexType() == IndexDef.IndexType.BITMAP) {
                                    if (!(colType == PrimitiveType.TINYINT || colType == PrimitiveType.SMALLINT
                                                  || colType == PrimitiveType.INT || colType == PrimitiveType.BIGINT ||
                                                  colType == PrimitiveType.CHAR || colType == PrimitiveType.VARCHAR)) {
                                        throw new AnalysisException(colType + " is not supported in bitmap index. "
                                                + "invalid column: " + indexColName);
                                    } else if (column.isKey()
                                            || column.getAggregationType() == AggregateType.NONE
                                            || column.getAggregationType() == AggregateType.REPLACE
                                            || column.getAggregationType() == AggregateType.REPLACE_IF_NOT_NULL) {
                                        found = true;
                                        break;
                                    } else {
                                        
                                        
                                        throw new AnalysisException(
                                                "BITMAP index only used in columns of DUP_KEYS table or "
                                                        + "key columns of UNIQUE_KEYS/AGG_KEYS table. invalid column: "
                                                        + indexColName);
                                    }
                                }
                            }
                        }

                        if (!found) {
                            throw new AnalysisException("BITMAP column does not exist in table. invalid column: "
                                    + indexColName);
                        }
                    }
                indexes.add(new Index(indexDef.getIndexName(), indexDef.getColumns(), indexDef.getIndexType(),
                        indexDef.getComment()));
                distinct.add(indexDef.getIndexName());
                distinctCol.add(indexDef.getColumns().stream().map(String::toUpperCase).collect(Collectors.toList()));
            }
            if (distinct.size() != indexes.size()) {
                throw new AnalysisException("index name must be unique.");
            }
            if (distinctCol.size() != indexes.size()) {
                throw new AnalysisException("same index columns have multiple index name is not allowed.");
            }
        }
    }