You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/04 17:50:21 UTC

[GitHub] [pinot] npawar commented on a diff in pull request #9712: add index key and size map to segment metadata

npawar commented on code in PR #9712:
URL: https://github.com/apache/pinot/pull/9712#discussion_r1014306434


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/SegmentMetadataImpl.java:
##########
@@ -245,6 +248,26 @@ private void init(PropertiesConfiguration segmentMetadataPropertiesConfiguration
       _schema.addField(columnMetadata.getFieldSpec());
     }
 
+    // Load index metadata
+    // Support V3 (e.g. SingleFileIndexDirectory only)
+    if (_segmentVersion == SegmentVersion.v3) {
+      File indexMapFile = new File(_indexDir, "v3" + File.separator + V1Constants.INDEX_MAP_FILE_NAME);
+      if (indexMapFile.exists()) {
+        PropertiesConfiguration mapConfig = CommonsConfigurationUtils.fromFile(indexMapFile);
+        for (String key : CommonsConfigurationUtils.getKeys(mapConfig)) {
+          try {
+            String[] parsedKeys = ColumnIndexUtils.parseIndexMapKeys(key, _indexDir.getPath());
+            if (parsedKeys[2].equals(ColumnIndexUtils.MAP_KEY_NAME_SIZE)) {
+              ColumnIndexType columnIndexType = ColumnIndexType.getValue(parsedKeys[1]);
+              _columnMetadataMap.get(parsedKeys[0]).getIndexSizeMap().put(columnIndexType, mapConfig.getLong(key));

Review Comment:
   do we need a nullcheck on the value of get() here? could it be that something is in index_map but not in metadata.properties (due to a column remove/index remove)?



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org