luchunliang commented on code in PR #6155: URL: https://github.com/apache/inlong/pull/6155#discussion_r993133586
########## inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AuditServiceImpl.java: ########## @@ -211,6 +231,31 @@ private SearchRequest toAuditSearchRequest(String index, String groupId, String return new SearchRequest(new String[]{index}, sourceBuilder); } + /** + * Convert to clickhouse search sql + * + * @param groupId The groupId of inlong + * @param streamId The streamId of inlong + * @param auditId The auditId of request + * @param dt The datetime of request + * @return clickhouse sql + */ + private String toAuditCkSql(String groupId, String streamId, String auditId, String dt) { + DateTimeFormatter formatter = DateTimeFormat.forPattern(DAY_FORMAT); + DateTime date = formatter.parseDateTime(dt); + String sDate = date.toString(SECOND_FORMAT); + String eDate = date.plusDays(1).toString(SECOND_FORMAT); + return new SQL() + .SELECT("log_ts", "sum(count) as total") + .FROM("apache_inlong_audit.audit_data") Review Comment: It is not good that code use fixed database name. ########## inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/AuditServiceImpl.java: ########## @@ -155,6 +161,20 @@ public List<AuditVO> listByCondition(AuditRequest request) throws IOException { auditId.equals(AuditConstants.AUDIT_ID_SORT_OUTPUT) ? sinkNodeType : null)); } } + } else if (AuditQuerySource.CLICKHOUSE == querySource) { + Statement ckStatement = clickhouseConfig.getCkStatement(); Review Comment: miss Statement.close(). -- 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