kuansix commented on code in PR #6931:
URL: https://github.com/apache/inlong/pull/6931#discussion_r1053930896


##########
inlong-sort/sort-connectors/mongodb-cdc/src/main/java/org/apache/inlong/sort/cdc/mongodb/DebeziumSourceFunction.java:
##########
@@ -485,7 +498,19 @@ public void run(SourceContext<T> sourceContext) throws 
Exception {
 
                             @Override
                             public void deserialize(SourceRecord record, 
Collector<T> out) throws Exception {
-                                if (sourceMetricData != null) {
+                                if (sourceMetricData != null && record != null 
&& migrateAll) {
+                                    Struct value = (Struct) record.value();
+                                    Struct source = 
value.getStruct(MongoDBEnvelope.NAMESPACE_FIELD);
+                                    if (null == source) {
+                                        source = 
value.getStruct(RecordUtils.DOCUMENT_TO_FIELD);
+                                    }
+                                    String dbName = 
source.getString(MongoDBEnvelope.NAMESPACE_DATABASE_FIELD);
+                                    String tableName = 
source.getString(MongoDBEnvelope.NAMESPACE_COLLECTION_FIELD);

Review Comment:
   done



-- 
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: commits-unsubscr...@inlong.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to