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


##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/SegmentContext.java:
##########
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.segment.spi;
+
+import 
org.apache.pinot.segment.spi.index.mutable.ThreadSafeMutableRoaringBitmap;
+import org.roaringbitmap.buffer.MutableRoaringBitmap;
+
+
+public class SegmentContext {
+  private final IndexSegment _indexSegment;
+  private MutableRoaringBitmap _queryableDocIdsSnapshot = null;
+
+  public SegmentContext(IndexSegment indexSegment) {
+    _indexSegment = indexSegment;
+  }
+
+  public IndexSegment getIndexSegment() {
+    return _indexSegment;
+  }
+
+  public MutableRoaringBitmap getQueryableDocIdsSnapshot() {
+    return _queryableDocIdsSnapshot;
+  }
+
+  public void setQueryableDocIdsSnapshot(MutableRoaringBitmap 
queryableDocIdsSnapshot) {
+    _queryableDocIdsSnapshot = queryableDocIdsSnapshot;
+  }
+
+  public static MutableRoaringBitmap 
getQueryableDocIdsSnapshotFromSegment(IndexSegment segment) {

Review Comment:
   This method should be maintained outside of the context. This is upsert 
specific logic, so it should be managed within the upsert metadata manager



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/TableUpsertMetadataManager.java:
##########
@@ -50,4 +53,6 @@ public interface TableUpsertMetadataManager extends Closeable 
{
    * @return A {@code Map} where keys are partition id and values are count of 
primary keys for that specific partition
    */
   Map<Integer, Long> getPartitionToPrimaryKeyCount();
+
+  List<SegmentContext> getSegmentContexts(List<IndexSegment> selectedSegments);

Review Comment:
   Should we pass in `List<SegmentContext>` and return `List<SegmentContext>`? 
Currently upsert is the only component decorating segment, but we might add 
more in the future



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