kfaraz commented on code in PR #15480:
URL: https://github.com/apache/druid/pull/15480#discussion_r1415628387
##########
server/src/main/java/org/apache/druid/server/audit/SQLAuditManager.java:
##########
@@ -268,10 +263,27 @@ private List<AuditEntry>
fetchAuditHistoryLastEntries(final String key, final St
return query
.bind("type", type)
.setMaxRows(theLimit)
- .map((index, r, ctx) -> JacksonUtils.readValue(jsonMapper,
r.getBytes("payload"), AuditEntry.class))
+ .map(resultMapper)
.list();
}
);
}
+ private class AuditEventMapper implements ResultSetMapper<AuditEvent>
+ {
+ @Override
+ public AuditEvent map(int index, ResultSet r, StatementContext ctx) throws
SQLException
+ {
+ // Read the record and convert to an AuditEvent that can deserialize the
payload on-demand
+ AuditRecord record = JacksonUtils.readValue(jsonMapper,
r.getBytes("payload"), AuditRecord.class);
Review Comment:
No, it doesn't fail.
Just to clarify, `payload` in this statement (i.e. the `payload` column of
the `druid_audit` table) refers to the entire `AuditEntry` as opposed to the
payload contained inside the `AuditEntry`.
##########
server/src/main/java/org/apache/druid/server/audit/SQLAuditManager.java:
##########
@@ -268,10 +263,27 @@ private List<AuditEntry>
fetchAuditHistoryLastEntries(final String key, final St
return query
.bind("type", type)
.setMaxRows(theLimit)
- .map((index, r, ctx) -> JacksonUtils.readValue(jsonMapper,
r.getBytes("payload"), AuditEntry.class))
+ .map(resultMapper)
.list();
}
);
}
+ private class AuditEventMapper implements ResultSetMapper<AuditEvent>
+ {
+ @Override
+ public AuditEvent map(int index, ResultSet r, StatementContext ctx) throws
SQLException
+ {
+ // Read the record and convert to an AuditEvent that can deserialize the
payload on-demand
+ AuditRecord record = JacksonUtils.readValue(jsonMapper,
r.getBytes("payload"), AuditRecord.class);
Review Comment:
No, it doesn't fail.
Just to clarify, `payload` in this statement (i.e. the `payload` column of
the `druid_audit` table) refers to the entire `AuditEntry` as opposed to the
String payload contained inside the `AuditEntry`.
--
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]