Skip to content

Conversation

dyp12
Copy link
Contributor

@dyp12 dyp12 commented Aug 14, 2025

Purpose of this pull request

close #9675

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@Hisoka-X
Copy link
Member

cc @wubx

@@ -88,9 +98,12 @@ private static SeaTunnelRowType createJsonRowType(SeaTunnelRowType databaseSchem
// but we don't need them
// and we don't need "old" , because can not support UPDATE_BEFORE,UPDATE_AFTER
return new SeaTunnelRowType(
new String[] {"data", "type"},
new String[] {"data", "type", "tableId", "ts"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cancel format is database and table fields, not tableId. Please refer https://docs.pingcap.com/zh/tidb/stable/ticdc-canal-json/#dml-event

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cancel format is database and table fields, not tableId. Please refer https://docs.pingcap.com/zh/tidb/stable/ticdc-canal-json/#dml-event

SeaTunnelRow do not have database and table fields, if use tableId to get db fields,may be get error data,remove it,only add ts field?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update SeaTunnelRowType to CatalogTable in

Then we can get table and database from CatalogTable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update SeaTunnelRowType to CatalogTable in

Then we can get table and database from CatalogTable.

MetadataUtil.getDatabase use tableId to get db,maybe can use it , update SeaTunnelRowType to CatalogTable will change manay file
image

@@ -78,7 +94,9 @@ public byte[] serialize(SeaTunnelRow row) {

private static SeaTunnelRowType createJsonRowType(SeaTunnelRowType databaseSchema) {
return new SeaTunnelRowType(
new String[] {"before", "after", "op"},
new SeaTunnelDataType[] {databaseSchema, databaseSchema, STRING_TYPE});
new String[] {"before", "after", "op", "tableId", "ts_ms"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debezium format doesn't contains tableId. Please refer https://help.aliyun.com/zh/flink/debezium

@@ -87,7 +96,7 @@ private static SeaTunnelRowType createJsonRowType(SeaTunnelRowType databaseSchem
// but we don't need them
// and we don't need "old" , because can not support UPDATE_BEFORE,UPDATE_AFTER
return new SeaTunnelRowType(
new String[] {"data", "type"},
new SeaTunnelDataType[] {databaseSchema, STRING_TYPE});
new String[] {"data", "type", "tableId", "ts"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as canal, maxwell doesn'ts contains tableId too. Please refer https://help.aliyun.com/zh/flink/maxwell-format

@@ -79,7 +88,7 @@ private static SeaTunnelRowType createJsonRowType(SeaTunnelRowType databaseSchem
// but we don't need them
// and we don't need "old" , because can not support UPDATE_BEFORE,UPDATE_AFTER
return new SeaTunnelRowType(
new String[] {"data", "type"},
new SeaTunnelDataType[] {databaseSchema, STRING_TYPE});
new String[] {"data", "type", "tableId", "op_ts"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dyp12 dyp12 requested a review from Hisoka-X August 18, 2025 06:39
"{\"data\":{\"id\":111,\"name\":\"scooter\",\"description\":\"Big 2-wheel scooter \",\"weight\":5.17},\"type\":\"INSERT\"}",
"{\"data\":{\"id\":111,\"name\":\"scooter\",\"description\":\"Big 2-wheel scooter \",\"weight\":5.17},\"type\":\"DELETE\"}");

"{\"data\":{\"id\":101,\"name\":\"scooter\",\"description\":\"Small 2-wheel scooter\",\"weight\":3.14},\"type\":\"INSERT\",\"table\":\"..test\",\"op_ts\":1589384406000}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why table is ..test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why table is ..test?

'..test' is because of db and schema is null

}

if (row.getOptions() != null && row.getOptions().containsKey(EVENT_TIME.getName())) {
reuse.setField(4, row.getOptions().get(EVENT_TIME.getName()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we standardize the precision of eventtime? I see that the unit is sometimes seconds and sometimes milliseconds. Can we standardize it to milliseconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we standardize the precision of eventtime? I see that the unit is sometimes seconds and sometimes milliseconds. Can we standardize it to milliseconds?

now all use milliseconds,when read data ,all eventtime is milliseconds
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comment in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comment in

i add it , and change metadata.md

@Hisoka-X Hisoka-X changed the title [Feature][json-format ] Improve maxwell_json,canal_json,debezium_json format add ts_ms and tableId [Feature][Format] Improve maxwell_json,canal_json,debezium_json format add ts_ms and table Aug 19, 2025
Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dyp12 . LGTM if ci passes.

@corgy-w corgy-w merged commit fb8444b into apache:dev Aug 20, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature][S3-Sink] Improve maxwell_json,canal_json,debezium_json format add ts_ms and [source]
3 participants