{"record":{"id":"b65ef018d3f08bba","repo":"apache/seatunnel","slug":"ddl-can-not-be-null-or-empty-string","errorCode":null,"errorMessage":"ddl can not be null or empty string!","messagePattern":"ddl can not be null or empty string!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java","lineNumber":293,"sourceCode":"                String.format(\n                        \"ALTER TABLE %s DROP COLUMN %s\",\n                        tablePath.getFullName(), quoteIdentifier(event.getColumn()));\n        if (!execute(dropColumnSQL, tablePath.getDatabaseName())) {\n            log.warn(\"Failed to alter table drop column, SQL:\" + dropColumnSQL);\n        }\n    }\n\n    /** execute sql in doris. */\n    public boolean execute(String ddl, String database)\n            throws IOException, IllegalArgumentException {\n        String responseEntity = executeThenReturnResponse(ddl, database);\n        return handleSchemaChange(responseEntity);\n    }\n\n    private String executeThenReturnResponse(String ddl, String database)\n            throws IOException, IllegalArgumentException {\n        if (StringUtils.isEmpty(ddl)) {\n            throw new IllegalArgumentException(\"ddl can not be null or empty string!\");\n        }\n        log.info(\"Execute SQL: {}\", ddl);\n        HttpPost httpPost = buildHttpPost(ddl, database);\n        return handleResponse(httpPost);\n    }\n\n    private boolean handleSchemaChange(String responseEntity) throws JsonProcessingException {\n        Map<String, Object> responseMap = objectMapper.readValue(responseEntity, Map.class);\n        String code = responseMap.getOrDefault(\"code\", \"-1\").toString();\n        if (code.equals(\"0\")) {\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * Check if the column exists in the table","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/schema/SchemaChangeManager.java#L275-L311","documentation":"executeThenReturnResponse refuses to send an HTTP request to the Doris FE when the generated DDL string is null or empty. This is an early invariant check: building an empty ALTER statement would produce a confusing HTTP error from FE, so the manager fails fast with IllegalArgumentException.","triggerScenarios":"applySchemaChange generates a DDL string that ends up empty — e.g. an AlterColumnEvent with no columns to change, a column-name extraction bug, or a caller passing null ddl directly.","commonSituations":"Upstream schema event with empty field list; bug in buildColumns handling of type mapping that yields an empty ALTER clause; programmatic use of SchemaChangeManager with unvalidated input.","solutions":["Log/inspect the schema-change event that produced the empty DDL and ensure it has the required column data","Skip schema changes whose generated DDL is empty instead of executing","Upgrade the connector if the event is a legitimate change that should produce non-empty DDL"],"exampleFix":"// before\nString ddl = buildDdl(event);\nschemaChangeManager.executeThenReturnResponse(ddl, db);\n// after\nString ddl = buildDdl(event);\nif (ddl != null && !ddl.isEmpty()) {\n    schemaChangeManager.executeThenReturnResponse(ddl, db);\n}","handlingStrategy":"validation","validationCode":"if (ddl == null || ddl.trim().isEmpty()) throw new IllegalArgumentException(\"generated DDL is empty\");","typeGuard":null,"tryCatchPattern":"try {\n    return manager.executeThenReturnResponse(ddl, db);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Skipping schema change: {}\", e.getMessage());\n    return null;\n}","preventionTips":["Validate schema events contain column data before generating DDL","Log the event before building DDL to catch empty-column cases early"],"tags":["validation","ddl","doris"],"backgroundTag":"empty-required-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}