gortiz commented on code in PR #10184:
URL: https://github.com/apache/pinot/pull/10184#discussion_r1151594395


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/BaseIndexHandler.java:
##########
@@ -40,14 +46,31 @@
  */
 public abstract class BaseIndexHandler implements IndexHandler {
   private static final Logger LOGGER = 
LoggerFactory.getLogger(BaseIndexHandler.class);
-
-  protected final IndexLoadingConfig _indexLoadingConfig;
   protected final Set<String> _tmpForwardIndexColumns;
   protected final SegmentDirectory _segmentDirectory;
+  protected final Map<String, FieldIndexConfigs> _fieldIndexConfigs;
+  @Nullable
+  protected final TableConfig _tableConfig;
 
   public BaseIndexHandler(SegmentDirectory segmentDirectory, 
IndexLoadingConfig indexLoadingConfig) {
+    this(segmentDirectory, indexLoadingConfig.getFieldIndexConfigByColName(), 
indexLoadingConfig.getTableConfig());
+  }
+
+  public BaseIndexHandler(SegmentDirectory segmentDirectory, Map<String, 
FieldIndexConfigs> fieldIndexConfigs,
+      @Nullable TableConfig tableConfig) {
     _segmentDirectory = segmentDirectory;
-    _indexLoadingConfig = indexLoadingConfig;
+    SegmentMetadataImpl segmentMetadata = 
segmentDirectory.getSegmentMetadata();
+    if (fieldIndexConfigs.keySet().equals(segmentMetadata.getAllColumns())) {
+      _fieldIndexConfigs = fieldIndexConfigs;
+    } else {

Review Comment:
   I think it is quite easier to read and difficult to make mistakes if the map 
has all the values. Obviously that cannot be in all scenarios, but it is almost 
free in this case where the number of keys is going to be limited and in the 
order of dozens.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to