healchow commented on code in PR #7580:
URL: https://github.com/apache/inlong/pull/7580#discussion_r1161170793
##########
inlong-sort/sort-connectors/jdbc/src/main/java/org/apache/inlong/sort/jdbc/internal/JdbcMultiBatchingOutputFormat.java:
##########
@@ -392,6 +456,58 @@ public final synchronized void writeRecord(In row) throws
IOException {
}
}
+ private void fillDirtyData(JdbcExec exec, String tableIdentifier) {
+ String[] identifiers = tableIdentifier.split("\\.");
+ String database;
+ String table;
+ String schema = null;
+ if (identifiers.length == 2) {
+ database = identifiers[0];
+ table = identifiers[1];
+ } else {
+ database = identifiers[0];
+ schema = identifiers[1];
+ table = identifiers[2];
+ }
+ TableMetricStatementExecutor executor = null;
+ try {
+ Field subExecutor;
+ if (exec instanceof TableMetricStatementExecutor) {
+ executor = (TableMetricStatementExecutor) exec;
+ } else if (exec instanceof TableBufferReducedStatementExecutor) {
+ subExecutor =
TableBufferReducedStatementExecutor.class.getDeclaredField("upsertExecutor");
+ subExecutor.setAccessible(true);
+ executor = (TableMetricStatementExecutor)
subExecutor.get(exec);
+ } else if (exec instanceof TableBufferedStatementExecutor) {
+ subExecutor =
TableBufferedStatementExecutor.class.getDeclaredField("statementExecutor");
+ subExecutor.setAccessible(true);
+ executor = (TableMetricStatementExecutor)
subExecutor.get(exec);
+ }
+ } catch (Exception e) {
+ LOG.error("parse executor failed" + e);
+ }
+
+ try {
+ DirtyOptions dirtyOptions = dirtySinkHelper.getDirtyOptions();
+ String dirtyLabel =
DirtySinkHelper.regexReplace(dirtyOptions.getLabels(),
DirtyType.BATCH_LOAD_ERROR, null,
+ database, table, schema);
+ String dirtyLogTag =
+ DirtySinkHelper.regexReplace(dirtyOptions.getLogTag(),
DirtyType.BATCH_LOAD_ERROR, null,
+ database, table, schema);
+ String dirtyIdentifier =
+ DirtySinkHelper.regexReplace(dirtyOptions.getIdentifier(),
DirtyType.BATCH_LOAD_ERROR,
+ null, database, table, schema);
+
+ if (executor != null) {
+ executor.setDirtyMetaData(dirtyLabel, dirtyLogTag,
dirtyIdentifier);
+ } else {
+ LOG.error("null executor");
Review Comment:
Please add more info for this `null executor`.
--
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]