somandal commented on code in PR #9982:
URL: https://github.com/apache/pinot/pull/9982#discussion_r1048889338


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/BaseIndexHandler.java:
##########
@@ -93,6 +100,24 @@ protected void 
createForwardIndexIfNeeded(SegmentDirectory.Writer segmentWriter,
       _tmpForwardIndexColumns.add(columnName);
     }
 
+    // Update the segmentMetadata
+    File indexDir = _segmentMetadata.getIndexDir();

Review Comment:
   That won't solve the issue where `_segmentMetadata` assigned inside the 
class won't reflect the new object outside the class :( 
   
   The problem is even if I make your suggested change, I'll have to do the 
following:
   
   ```
     public static SegmentMetadata updateMetadataProperties(SegmentMetadata 
segmentMetadata, Map<String,
         String> metadataProperties, File indexDir, SegmentDirectory 
segmentDirectory)
         throws IOException {
       PropertiesConfiguration propertiesConfiguration = 
SegmentMetadataUtils.getPropertiesConfiguration(segmentMetadata);
       for (Map.Entry<String, String> entry : metadataProperties.entrySet()) {
         propertiesConfiguration.setProperty(entry.getKey(), entry.getValue());
       }
       
SegmentMetadataUtils.savePropertiesConfiguration(propertiesConfiguration);
   
       segmentMetadata = new SegmentMetadataImpl(indexDir);
       segmentDirectory.reloadMetadata();
   
       return segmentMetadata;
     }
   ```
   
   Since a new object is created and returned and we assign that like this: 
`_segmentMetadata = updateMetadataProperties(...) `, it's still replacing the 
local class object and not the object outside the class. 
   
   Don't know if it helps, but I am essentially running into the problem 
discussed in this SO: 
https://stackoverflow.com/questions/60125350/passing-object-in-java-and-try-to-change-them-in-many-ways



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