obelix74 commented on code in PR #3385:
URL: https://github.com/apache/polaris/pull/3385#discussion_r2713836593
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -315,6 +319,264 @@ public void writeEvents(@Nonnull List<PolarisEvent>
events) {
}
}
+ /**
+ * Writes a scan metrics report to the database as a first-class entity.
+ *
+ * @param report the scan metrics report to persist
+ */
+ public void writeScanMetricsReport(@Nonnull ModelScanMetricsReport report) {
+ try {
+ PreparedQuery pq =
+ QueryGenerator.generateInsertQueryWithoutRealmId(
+ ModelScanMetricsReport.ALL_COLUMNS,
+ ModelScanMetricsReport.TABLE_NAME,
Review Comment:
I've added schema version checks to all metrics persistence methods. The
implementation:
**Added:**
• METRICS_TABLES_MIN_SCHEMA_VERSION = 4 constant
• supportsMetricsPersistence() public method for capability checking
• Schema version validation in all 9 metrics methods
Behavior on schema < 4:
| Method Type | Behavior |
|-------------|----------|
| Write methods | Log at DEBUG and return silently (no-op) |
| Query methods | Return empty list |
| Delete methods | Return 0 |
This follows the existing pattern used in hasOverlappingSiblings():
```
if (this.schemaVersion < 2) {
return Optional.empty();
}
```
The supportsMetricsPersistence() method is also exposed publicly so callers
(like JdbcMetricsPersistence in PR2) can check capability before attempting
operations.
--
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]