Skip to content

[Bug] MySQL ENUM type mapping fails during CDC job build: ValidationException (StringLength must be >= 1) #4556

Description

@kammy7788

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

When using Dinky (based on Flink CDC) to sync a table containing a MySQL ENUM type column, the job fails to start and throws a ValidationException. It appears that Dinky (or the underlying Flink CDC / Fluss) fails to handle the length metadata correctly when parsing the MySQL ENUM type, resulting in an invalid length (e.g., 0) being passed to Flink's VarChar type.

What you expected to happen

ERROR org.dinky.cdc.AbstractSinkBuilder(153): Build cn_orders_cn.cc_prom_record cdc sync failed...
org.apache.flink.table.api.ValidationException: Variable character string length must be between 1 and 2147483647 (both inclusive).
at org.apache.flink.table.types.logical.VarCharType.(VarCharType.java:75)
at org.dinky.cdc.convert.DataTypeConverter.getLogicalType(DataTypeConverter.java:113)

How to reproduce

  1. Source Table Schema: Create a table in MySQL containing an ENUM type column.

CREATE TABLE cc_prom_record (
prom_id int unsigned NOT NULL AUTO_INCREMENT,
prom_order_status enum('Open','Close','Cancel','Pending') ..., -- Problematic column
PRIMARY KEY (prom_id)
);

  1. Dinky Job Configuration: Use the EXECUTE CDCSOURCE syntax to attempt a full + incremental sync of this table.
  2. Result: The job submission fails, and the logs show a type validation error.

Anything else

Dinky Version: 1.2.5

Root Cause Analysis
MySQL ENUM: In MySQL, ENUM is a special string object that allows choosing a value from a predefined set of values specified during table creation.
Flink Type Constraint: Flink's VarChar type strictly requires the length to be between 1 and 2147483647.
Mapping Defect: When parsing the ENUM type, Dinky (or the underlying Flink CDC / Fluss) incorrectly maps it to VarChar(0) or fails to calculate its maximum byte length properly, triggering Flink's validation exception.

Version

1.2.3

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

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