public static List generateDDLSql()

in flink-doris-connector/src/main/java/org/apache/doris/flink/sink/writer/SchemaChangeHelper.java [58:85]


    public static List<String> generateDDLSql(String table) {
        ddlSchemas.clear();
        List<String> ddlList = Lists.newArrayList();
        for (FieldSchema fieldSchema : addFieldSchemas) {
            String name = fieldSchema.getName();
            String type = fieldSchema.getTypeString();
            String defaultValue = fieldSchema.getDefaultValue();
            String comment = fieldSchema.getComment();
            String addDDL = String.format(ADD_DDL, table, name, type);
            if (!StringUtils.isNullOrWhitespaceOnly(defaultValue)) {
                addDDL = addDDL + " DEFAULT " + defaultValue;
            }
            if (!StringUtils.isNullOrWhitespaceOnly(comment)) {
                addDDL = addDDL + " COMMENT " + comment;
            }
            ddlList.add(addDDL);
            ddlSchemas.add(new DDLSchema(name, false));
        }
        for (String columName : dropFieldSchemas) {
            String dropDDL = String.format(DROP_DDL, table, columName);
            ddlList.add(dropDDL);
            ddlSchemas.add(new DDLSchema(columName, true));
        }

        dropFieldSchemas.clear();
        addFieldSchemas.clear();
        return ddlList;
    }