Open andriy-buryy opened 1 year ago
ticdc will parse enum to int value https://github.com/pingcap/tiflow/blob/2abe0212a1552c65acfaf677343f00a3155882f1/cdc/entry/mounter.go#L438-L441
For the enum type, represented as an integer string, this matches the official implementation.
Hi,
I see, thank you for the explanation.
Maybe it will be possible to provide the full enum field definition in the mysqlType
field?
I mean include enum options, like it is done in table schema definition: enum('none', 'active', 'reserved', 'sold')
.
Or use any other way to add enum options to Kafka message.
Because for now, if we need to have the enum value as a string, there is no way to map enum option number to enum option value other than caching this mapping from the table schema definition and updating the cache on every ALTER
event. But this approach is still limited and can be used if events are produced to Kafka topic with 1 partition.
we are also glad that we can config enum is handled by int or string
Hi,
I see, thank you for the explanation.
Maybe it will be possible to provide the full enum field definition in the
mysqlType
field? I mean include enum options, like it is done in table schema definition:enum('none', 'active', 'reserved', 'sold')
. Or use any other way to add enum options to Kafka message.Because for now, if we need to have the enum value as a string, there is no way to map enum option number to enum option value other than caching this mapping from the table schema definition and updating the cache on every
ALTER
event. But this approach is still limited and can be used if events are produced to Kafka topic with 1 partition.
you can set content-compatible=true
in sink-uri to enable this feature
https://docs.pingcap.com/tidb/stable/ticdc-canal-json#mysqltype-field
What did you do?
Create TiCDC changefeed:
Create table
test_table
Insert record
Check data in the TiDB:
Check the
INSERT
event message value in the Kafka topic:What did you expect to see?
The
status
enum field value in the Kafka message should be"active"
(the same as in the database).What did you see instead?
The
status
enum field value in the Kafka message is"2"
(not the same as in the database).Versions of the cluster
Upstream TiDB cluster version (execute
SELECT tidb_version();
in a MySQL client):Upstream TiKV version (execute
tikv-server --version
):TiCDC version (execute
cdc version
):