Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table column type enum is converted to AVRO decimal logical type but should be converted to Avro string type #4453

Closed
keweishang opened this issue Jan 24, 2022 · 2 comments · Fixed by #4704
Assignees
Labels
area/ticdc Issues or PRs related to TiCDC. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@keweishang
Copy link

What did you do?

  1. Create a table called employees. Its employee_type column is enum.
CREATE TABLE employees (
  id int(20) unsigned NOT NULL AUTO_INCREMENT,
  employee_type enum('a','b','c','d','e') COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (id)
);
  1. Create TiCDC changefeed
tiup cdc cli changefeed create \
--pd="http://localhost:2379" \
--sink-uri="kafka://localhost:9092/test?protocol=avro&partition-num=1&replication-factor=3" \
--config=./configs/test.toml \
--opts "registry=http://localhost:8081" \
--changefeed-id=test
  1. Insert a row
INSERT INTO employees values (1, 'b');
  1. Check Kafka schema registry's schema.
...
{
      "name" : "employee_type",
      "type" : {
        "type" : "bytes",
        "logicalType" : "decimal",
        "precision" : 8,
        "scale" : 0
      }
}
...

What did you expect to see?

The avro type of the employee field should be string

What did you see instead?

The avro type of the employee field is decimal logical type

Versions of the cluster

Upstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

Release Version: v5.3.0
Edition: Community
Git Commit Hash: 4a1b2e9fe5b5afb1068c56de47adb07098d768d6
Git Branch: heads/refs/tags/v5.3.0
UTC Build Time: 2021-11-24 13:31:41
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

TiCDC version (execute cdc version):

5.3.0
@keweishang keweishang added area/ticdc Issues or PRs related to TiCDC. type/bug The issue is confirmed as a bug. labels Jan 24, 2022
@dveeden dveeden self-assigned this Jan 24, 2022
@zhangyangyu
Copy link
Member

I think this also applies to SET column type.

@zhangyangyu
Copy link
Member

/remove-label affects-5.3

ti-chi-bot pushed a commit that referenced this issue Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants