Skip to content

[BUG-DATA-6] DDL parser parseSql() return value is always null — dead code #1298

Description

@minguyen9988

Summary

Both overloads of MySQLDDLParserService.parseSql() declare String clickHouseResult = null on entry and return it at the end without ever assigning it. The translated DDL is written to the StringBuffer parsedQuery side-channel parameter, but the return value is always null.

Affected Code

File: sink-connector-lightweight/src/main/java/com/altinity/clickhouse/debezium/embedded/parser/MySQLDDLParserService.java

Lines 86-105 and 117-138:

public String parseSql(String sql, String databaseName, StringBuffer parsedQuery) {
    String clickHouseResult = null;
    // ... parsing logic writes to parsedQuery ...
    return clickHouseResult;  // always null
}

Impact

Any caller that relies on the return value of parseSql() instead of the parsedQuery parameter will receive null and silently lose the parsed DDL. The interface DDLParserService declares the return as String, misleading callers.

Fix

Return parsedQuery.toString() instead of the never-assigned clickHouseResult.

Severity

HIGH — silent data loss if callers use the return value

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions