public static void analyze(CreateTableStmt statement, ConnectContext context) {
        final TableName tableNameObject = statement.getDbTbl();
        MetaUtils.normalizationTableName(context, tableNameObject);

        final String catalogName = tableNameObject.getCatalog();
        MetaUtils.checkCatalogExistAndReport(catalogName);

        final String tableName = tableNameObject.getTbl();
        FeNameFormat.checkTableName(tableName);

        Database db = MetaUtils.getDatabase(catalogName, tableNameObject.getDb());
        if (statement instanceof CreateTemporaryTableStmt) {
            analyzeTemporaryTable(statement, context, catalogName, db, tableName);
        } else {
            if (db.getTable(tableName) != null && !statement.isSetIfNotExists()) {
                ErrorReport.reportSemanticException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName);
            }
        }

        analyzeEngineName(statement, catalogName);
        analyzeCharsetName(statement);

        preCheckColumnRef(statement);
        analyzeKeysDesc(statement);
        analyzeSortKeys(statement);
        analyzePartitionDesc(statement);
        analyzeDistributionDesc(statement);
        analyzeColumnRef(statement, catalogName);

        if (statement.isHasGeneratedColumn()) {
            analyzeGeneratedColumn(statement, context);
        }

        analyzeIndexDefs(statement);
    }
@Test
    public void testAnalyze() throws Exception {
        String sql = "CREATE TABLE test_create_table_db.starrocks_test_table\n" +
                "(\n" +
                "    `tag_id` string,\n" +
                "    `tag_name` string\n" +
                ") ENGINE = OLAP PRIMARY KEY(`id`)\n" +
                "DISTRIBUTED BY HASH(`id`)\n" +
                "ORDER BY(`id`)\n" +
                "PROPERTIES (\n" +
                "\"replication_num\" = \"1\",\n" +
                "\"in_memory\" = \"false\",\n" +
                "\"enable_persistent_index\" = \"true\",\n" +
                "\"replicated_storage\" = \"true\",\n" +
                "\"compression\" = \"LZ4\"\n" +
                ")\n";

        expectedEx.expect(SemanticException.class);
        expectedEx.expectMessage("doesn't exist");
        CreateTableStmt createTableStmt = (CreateTableStmt) com.starrocks.sql.parser.SqlParser
                .parse(sql, connectContext.getSessionVariable().getSqlMode()).get(0);
        CreateTableAnalyzer.analyze(createTableStmt, connectContext);
    }