EMsnap commented on code in PR #4010:
URL: https://github.com/apache/incubator-inlong/pull/4010#discussion_r861424177
##########
inlong-sort/sort-single-tenant/src/main/java/org/apache/inlong/sort/singletenant/flink/cdc/mysql/table/MySqlReadableMetadata.java:
##########
@@ -96,26 +96,60 @@ public Object read(SourceRecord record) {
}),
DATA(
- "meta.data",
- DataTypes.BIGINT(),
- new MetadataConverter() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public Object read(SourceRecord record) {
- record.value().toString();
- Struct messageStruct = (Struct) record.value();
- Struct sourceStruct =
messageStruct.getStruct(Envelope.FieldName.SOURCE);
- return TimestampData.fromEpochMillis(
- (Long)
sourceStruct.get(AbstractSourceInfo.TIMESTAMP_KEY));
+ "meta.data",
+ DataTypes.STRING(),
+ new MetadataConverter() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Object read(SourceRecord record) {
+ record.value().toString();
+ Struct messageStruct = (Struct) record.value();
+ Struct sourceStruct =
messageStruct.getStruct(FieldName.TIMESTAMP);
+ sourceStruct.get(AbstractSourceInfo.TIMESTAMP_KEY);
+ return TimestampData.fromEpochMillis(
+ (Long) sourceStruct.get(AbstractSourceInfo.TIMESTAMP_KEY));
+ }
+
+ @Override
+ public Object read(SourceRecord record,
+ @org.jetbrains.annotations.Nullable TableChanges.TableChange
tableSchema, RowData rowData) {
+
+ Struct messageStruct = (Struct) record.value();
+ Struct sourceStruct =
messageStruct.getStruct(FieldName.SOURCE);
+ // tableName
+ String tableName = getMetaData(record,
AbstractSourceInfo.TABLE_NAME_KEY);
+ // databaseName
+ String databaseName = getMetaData(record,
AbstractSourceInfo.DATABASE_NAME_KEY);
+ // op_ts
+ long op_ts = (Long)
sourceStruct.get(AbstractSourceInfo.TIMESTAMP_KEY);
Review Comment:
thx, make sense
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]