Jackie-Jiang commented on code in PR #10158:
URL: https://github.com/apache/pinot/pull/10158#discussion_r1083143660


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/SegmentLocalFSDirectory.java:
##########
@@ -248,25 +250,26 @@ protected void load()
 
   private synchronized void loadData()
       throws IOException {
-    if (_columnIndexDirectory != null) {
-      return;
+    if (_columnIndexDirectory == null) {

Review Comment:
   Suggest reverting this part. We do the check to prevent `loadData()` twice. 
We only need to add `if 
(CollectionUtils.isNotEmpty(_segmentMetadata.getStarTreeV2MetadataList()) {...}`



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/SegmentLocalFSDirectory.java:
##########
@@ -349,6 +356,42 @@ public boolean hasIndexFor(String column, ColumnIndexType 
type) {
       return _columnIndexDirectory.hasIndexFor(column, type);
     }
 
+    public boolean hasSegmentIndex(SegmentIndexType type) {
+      if (type != SegmentIndexType.STAR_TREE_INDEX) {
+        throw new IllegalArgumentException("Unknown SegmentIndexType: " + 
type);
+      }
+      return _starTreeIndexReader != null;
+    }
+
+    public SegmentDirectory.Reader getSegmentIndexReaderFor(String indexName, 
SegmentIndexType type) {

Review Comment:
   I don't think this is a common abstraction for segment level index. Suggest 
for now just add APIs for star-tree: `getStarTreeReader(int starTreeId)`



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