MOBIN-F commented on code in PR #3791:
URL: https://github.com/apache/flink-cdc/pull/3791#discussion_r1879255157


##########
flink-cdc-connect/flink-cdc-source-connectors/flink-connector-debezium/src/main/java/org/apache/flink/cdc/debezium/event/DebeziumEventDeserializationSchema.java:
##########
@@ -102,21 +118,70 @@ public List<DataChangeEvent> 
deserializeDataChangeRecord(SourceRecord record) th
         Schema valueSchema = record.valueSchema();
         Map<String, String> meta = getMetadata(record);
 
+        if (includeSchemaInfo) {
+            if (jsonConverter == null) {
+                initializeJsonConverter();
+            }
+        }
         if (op == Envelope.Operation.CREATE || op == Envelope.Operation.READ) {
             RecordData after = extractAfterDataRecord(value, valueSchema);
-            return 
Collections.singletonList(DataChangeEvent.insertEvent(tableId, after, meta));
+            List<DataChangeEvent> dataChangeEvent =
+                    includeSchemaInfo
+                            ? Collections.singletonList(
+                                    DataChangeEvent.insertEvent(
+                                            tableId,
+                                            after,
+                                            meta,
+                                            extractBeforeAndAfterSchema(
+                                                    
jsonConverter.asJsonSchema(valueSchema))))

Review Comment:
   Through the jsonConverter.asJsonSchema(valueSchema) method, we can easily 
obtain the complete schema json information of debezium-json.
   At first, I wanted to convert the schema josn to GenericRowData, but the 
schema structure of debezium is too complex and difficult to implement.
   Finally, I chose to pass the schema json information as a string to the 
downstream, which can reduce some serialization and deserialization overhead



-- 
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]

Reply via email to