This is an automated email from the ASF dual-hosted git repository.

yuqi4733 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new a6284d1a4a [#9038] fix(storage): Fix the hard deletion of statistics 
(#9039)
a6284d1a4a is described below

commit a6284d1a4ac505583030396036f4ba469fb3495c
Author: roryqi <[email protected]>
AuthorDate: Fri Nov 7 14:16:49 2025 +0800

    [#9038] fix(storage): Fix the hard deletion of statistics (#9039)
    
    ### What changes were proposed in this pull request?
    
    Fix the hard deletion of statistics
    
    ### Why are the changes needed?
    
    Fix: #9308
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    No.
---
 .../mapper/provider/postgresql/StatisticPostgresSQLProvider.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/StatisticPostgresSQLProvider.java
 
b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/StatisticPostgresSQLProvider.java
index 53aaea7f71..800e519afc 100644
--- 
a/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/StatisticPostgresSQLProvider.java
+++ 
b/core/src/main/java/org/apache/gravitino/storage/relational/mapper/provider/postgresql/StatisticPostgresSQLProvider.java
@@ -59,4 +59,13 @@ public class StatisticPostgresSQLProvider extends 
StatisticBaseSQLProvider {
         + "  deleted_at = EXCLUDED.deleted_at"
         + "</script>";
   }
+
+  @Override
+  public String deleteStatisticsByLegacyTimeline(Long legacyTimeline, int 
limit) {
+    return "DELETE FROM "
+        + STATISTIC_META_TABLE_NAME
+        + " WHERE statistic_id IN (SELECT statistic_id FROM "
+        + STATISTIC_META_TABLE_NAME
+        + " WHERE deleted_at > 0 AND deleted_at < #{legacyTimeline} LIMIT 
#{limit})";
+  }
 }

Reply via email to