rohityadav1993 commented on code in PR #14494:
URL: https://github.com/apache/pinot/pull/14494#discussion_r1850516862


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java:
##########
@@ -425,13 +426,14 @@ public SuccessResponse reloadSegment(
   /**
    * Helper method to find the existing table based on the given table name 
(with or without type suffix) and segment
    * name.
-   * TODO: Real-time table might also contain uploaded segments (not with LLC 
name), which is not handled here.
    */
   private String getExistingTable(String tableName, String segmentName) {
     TableType tableType = 
TableNameBuilder.getTableTypeFromTableName(tableName);
     if (tableType == null) {
       // Derive table type from segment name if the given table name doesn't 
have type suffix
-      tableType = LLCSegmentName.isLLCSegment(segmentName) ? 
TableType.REALTIME : TableType.OFFLINE;

Review Comment:
   For LCCSegment too, it seems it is not guaranteed only for realtime table. 
There are no validations in `PinotSegmentUploadDownloadRestletResource` that 
LCCSegment should only be uploaded to realtime table and segment assignments 
for offline tables don't check segmentNames.
   
   Additionally, there are places in code discouraging deriving table type from 
segmentName, I think we can either consolidate segmentName to table types in 
one place and/or enforce segmentNames to realtime table type:
   
   ```
   // Fetch table name. Try to derive the table name from the parameter and 
then from segment metadata
         String rawTableName;
         if (StringUtils.isNotEmpty(tableName)) {
           rawTableName = TableNameBuilder.extractRawTableName(tableName);
         } else {
           // TODO: remove this when we completely deprecate the table name 
from segment metadata
           rawTableName = segmentMetadata.getTableName();
           LOGGER.warn("Table name is not provided as request query parameter 
when uploading segment: {} for table: {}",
               segmentName, rawTableName);
         }
   ```
   
   



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