JNSimba commented on code in PR #67489:
URL: https://github.com/apache/doris/pull/67489#discussion_r3932159169
##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertTask.java:
##########
@@ -130,12 +157,34 @@ public void run() throws JobException {
}
throw new JobException(errMsg);
} catch (Exception e) {
+ String errorMessage = Util.getRootCauseMessage(e);
+ if (auditEnabled && ctx.getState().getStateType() !=
QueryState.MysqlStateType.ERR) {
+ ctx.getState().setError(ErrorCode.ERR_INTERNAL_ERROR,
errorMessage);
+ }
log.warn("execute insert task error, label is {},offset is {}",
taskCommand.getLabelName(),
runningOffset.toString(), e);
- throw new JobException(Util.getRootCauseMessage(e));
+ throw new JobException(errorMessage);
+ } finally {
+ if (auditEnabled) {
+ AuditLogHelper.logAuditLog(ctx, auditSql,
stmtExecutor.getParsedStmt(),
+ stmtExecutor.getQueryStatisticsForAuditLog(), true);
+ }
}
}
+ private String getAuditSql(TreeMap<Pair<Integer, Integer>, String>
replacements) {
+ List<UnboundTVFRelation> tvfRelations =
taskCommand.getAllTVFRelation();
+ Preconditions.checkState(replacements.size() == 1 &&
tvfRelations.size() == 1,
+ "S3 streaming insert must contain exactly one TVF");
+ String rewrittenProperties =
tvfRelations.get(0).getProperties().getMap().entrySet().stream()
+ .map(entry ->
SqlLiteralUtils.quoteStringLiteral(entry.getKey()) + " = "
+ + SqlLiteralUtils.quoteStringLiteral(entry.getValue()))
+ .collect(Collectors.joining(", "));
+ Pair<Integer, Integer> tvfPropertiesRange = replacements.firstKey();
+ replacements.replace(tvfPropertiesRange, rewrittenProperties);
+ return BaseViewInfo.rewriteSql(replacements, sql);
Review Comment:
Not considering
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]