Jackie-Jiang commented on code in PR #15257: URL: https://github.com/apache/pinot/pull/15257#discussion_r2006134057
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java: ########## @@ -199,6 +225,70 @@ private void manageRetentionForRealtimeTable(String realtimeTableName, Retention } } + @VisibleForTesting + void manageRetentionForHybridTable(TableConfig realtimeTableConfig, TableConfig offlineTableConfig) { + LOGGER.info("Managing retention for hybrid table: {}", realtimeTableConfig.getTableName()); + List<String> segmentsToDelete = new ArrayList<>(); + String realtimeTableName = realtimeTableConfig.getTableName(); + String rawTableName = TableNameBuilder.extractRawTableName(realtimeTableName); + String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(rawTableName); + try { + ZkHelixPropertyStore<ZNRecord> propertyStore = _pinotHelixResourceManager.getPropertyStore(); + Schema schema = ZKMetadataProvider.getTableSchema(propertyStore, offlineTableName); + if (schema == null) { + throw new RuntimeException("Failed to get schema for table: " + offlineTableName); + } + String timeColumn = null; + SegmentsValidationAndRetentionConfig validationConfig = offlineTableConfig.getValidationConfig(); + if (validationConfig != null) { + timeColumn = validationConfig.getTimeColumnName(); + } + if (StringUtils.isEmpty(timeColumn)) { + throw new RuntimeException("TimeColumn is null or empty for table: " + offlineTableName); + } + DateTimeFieldSpec dateTimeSpec = schema.getSpecForTimeColumn(timeColumn); + if (dateTimeSpec == null) { + throw new RuntimeException(String.format("Failed to get DateTimeFieldSpec for time column: %s of table: %s", + timeColumn, offlineTableName)); + } + DateTimeFormatSpec timeFormatSpec = dateTimeSpec.getFormatSpec(); + if (timeFormatSpec.getColumnUnit() == null) { Review Comment: The remaining part is correct. We shouldn't check `column unit` -- 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...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org