jackjlli commented on code in PR #10352:
URL: https://github.com/apache/pinot/pull/10352#discussion_r1128614697


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/IndexLoadingConfig.java:
##########
@@ -410,35 +415,55 @@ public FSTType getFSTIndexType() {
    * @return a set containing names of text index columns
    */
   public Set<String> getTextIndexColumns() {
-    return _textIndexColumns;
+    return unmodifiable(_textIndexColumns);
   }
 
   public Set<String> getFSTIndexColumns() {
-    return _fstIndexColumns;
+    return unmodifiable(_fstIndexColumns);
   }
 
   public Map<String, JsonIndexConfig> getJsonIndexConfigs() {
-    return _jsonIndexConfigs;
+    return unmodifiable(_jsonIndexConfigs);
   }
 
   public Map<String, H3IndexConfig> getH3IndexConfigs() {
-    return _h3IndexConfigs;
+    return unmodifiable(_h3IndexConfigs);
   }
 
   public Map<String, Map<String, String>> getColumnProperties() {
-    return _columnProperties;
+    return unmodifiable(_columnProperties);
   }
 
   public void setColumnProperties(Map<String, Map<String, String>> 
columnProperties) {
-    _columnProperties = columnProperties;
+    _columnProperties = new HashMap<>(columnProperties);
   }
 
   /**
    * For tests only.
    */
   @VisibleForTesting
   public void setInvertedIndexColumns(Set<String> invertedIndexColumns) {
-    _invertedIndexColumns = invertedIndexColumns;
+    _invertedIndexColumns = new HashSet<>(invertedIndexColumns);
+  }
+
+  @VisibleForTesting
+  public void addInvertedIndexColumns(String... invertedIndexColumns) {
+    _invertedIndexColumns.addAll(Arrays.asList(invertedIndexColumns));
+  }
+
+  @VisibleForTesting
+  public void addInvertedIndexColumns(Collection<String> invertedIndexColumns) 
{
+    _invertedIndexColumns.addAll(invertedIndexColumns);
+  }
+
+  @VisibleForTesting
+  public void removeInvertedIndexColumns(String... invertedIndexColumns) {
+    Arrays.asList(invertedIndexColumns).forEach(_invertedIndexColumns::remove);

Review Comment:
   Can this method call the one in Line 465 below? That can help reduce the 
duplicate code. Same for the other methods which contains two methods for the 
same purposes.



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/mutable/MutableSegmentImpl.java:
##########
@@ -244,7 +244,7 @@ public boolean isMutableSegment() {
     _logger =
         LoggerFactory.getLogger(MutableSegmentImpl.class.getName() + "_" + 
_segmentName + "_" + config.getStreamName());
 
-    Set<String> noDictionaryColumns = config.getNoDictionaryColumns();
+    Set<String> noDictionaryColumns = new 
HashSet<>(config.getNoDictionaryColumns());

Review Comment:
   nit: I know it's because the elements of this set can be removed down below 
but it'd be good to add some comments here to explain why the copy of 
`noDictionaryColumns` is made here.



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