rajagopr commented on code in PR #15257:
URL: https://github.com/apache/pinot/pull/15257#discussion_r2006117235


##########
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 `TimeBoundaryInfo` is providing the `timeValue` in the configured time 
format. We need to convert this value into a value in milliseconds for 
comparison with `segmentZKMetadata.getEndTimeMs()`. The method 
`DateTimeFormatSpec.fromFormatToMillis(String dateTimeValue)` appears to handle 
the `SIMPLE_DATE_FORMAT`. 
   
   Please suggest alternative approach if you see issues with the above 
approach. 



-- 
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

Reply via email to