Kikyou1997 commented on code in PR #18069:
URL: https://github.com/apache/doris/pull/18069#discussion_r1147267511
##########
fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsRepository.java:
##########
@@ -131,6 +138,62 @@ private static String constructId(Object... params) {
return stringJoiner.toString();
}
+ public static void dropStatistics(Long dbId,
+ Set<Long> tblIds, Set<String> colNames, Set<Long> partIds) {
+ dropStatistics(dbId, tblIds, colNames, partIds, false);
+ }
+
+ public static void dropHistogram(Long dbId,
+ Set<Long> tblIds, Set<String> colNames, Set<Long> partIds) {
+ dropStatistics(dbId, tblIds, colNames, partIds, true);
+ }
+
+ private static void dropStatistics(Long dbId,
+ Set<Long> tblIds, Set<String> colNames, Set<Long> partIds, boolean
isHistogram) {
+ if (dbId <= 0) {
+ throw new IllegalArgumentException("Database id is not
specified.");
+ }
+
+ StringBuilder predicate = new StringBuilder();
+ predicate.append(String.format("db_id = '%d'", dbId));
+
+ if (!tblIds.isEmpty()) {
+ StringJoiner predicateBuilder = new StringJoiner(",", "(", ")");
+ tblIds.stream().map(id -> String.format("'%s'", id))
+ .forEach(predicateBuilder::add);
+ String tblPredicate = String.format(" AND tbl_id IN %s",
predicateBuilder);
+ predicate.append(tblPredicate);
+ }
+
+ if (!colNames.isEmpty()) {
+ StringJoiner predicateBuilder = new StringJoiner(",", "(", ")");
Review Comment:
Abstract these code into a method plz
--
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]