gong commented on code in PR #7062:
URL: https://github.com/apache/inlong/pull/7062#discussion_r1057554402


##########
inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java:
##########
@@ -507,8 +512,35 @@ private void handleDirtyData(Object dirtyData, DirtyType 
dirtyType, Exception e)
                 LOG.warn("Dirty sink failed", ex);
             }
         }
+        metricData.invokeDirty(1, 
dirtyData.toString().getBytes(StandardCharsets.UTF_8).length);
+    }
+
+    private void handleMultipleDirtyData(Object dirtyData, DirtyType 
dirtyType, Exception e) {
+        JsonNode rootNode = null;
+        try {
+            rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) 
dirtyData).getBinary(0));
+        } catch (Exception ex) {
+            LOG.warn("handle dirty data: rootnode is null", ex);
+        }
+
+        if (dirtySink != null) {
+            DirtyData.Builder<Object> builder = DirtyData.builder();
+            try {
+                builder.setData(dirtyData)
+                        .setDirtyType(dirtyType)
+                        .setLabels(jsonDynamicSchemaFormat.parse(rootNode, 
dirtyOptions.getLabels()))
+                        .setLogTag(jsonDynamicSchemaFormat.parse(rootNode, 
dirtyOptions.getLogTag()))
+                        .setDirtyMessage(e.getMessage())
+                        .setIdentifier(jsonDynamicSchemaFormat.parse(rootNode, 
dirtyOptions.getIdentifier()));
+                dirtySink.invoke(builder.build());
+            } catch (Exception ex) {
+                if (!dirtyOptions.ignoreSideOutputErrors()) {
+                    throw new RuntimeException(ex);
+                }
+                LOG.warn("Dirty sink failed", ex);
+            }
+        }
         try {
-            JsonNode rootNode = jsonDynamicSchemaFormat.deserialize(((RowData) 
dirtyData).getBinary(0));
             metricData.outputDirtyMetricsWithEstimate(
                     jsonDynamicSchemaFormat.parse(rootNode, databasePattern),
                     null, jsonDynamicSchemaFormat.parse(rootNode, 
tablePattern), 1,

Review Comment:
   schema is null, It will always lost table level metric



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