deemoliu commented on code in PR #11791:
URL: https://github.com/apache/pinot/pull/11791#discussion_r1362911347


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/BasePartitionUpsertMetadataManager.java:
##########
@@ -138,15 +138,17 @@ public void addSegment(ImmutableSegment segment) {
       Preconditions.checkState(_enableSnapshot, "Upsert TTL must have snapshot 
enabled");
       Preconditions.checkState(_comparisonColumns.size() == 1,
           "Upsert TTL does not work with multiple comparison columns");
-      // TODO: Support deletion for TTL. Need to construct queryableDocIds 
when adding segments out of TTL.
-      Preconditions.checkState(_deleteRecordColumn == null, "Upsert TTL 
doesn't work with record deletion");
       Number maxComparisonValue =
           (Number) 
segment.getSegmentMetadata().getColumnMetadataMap().get(_comparisonColumns.get(0)).getMaxValue();
       if (maxComparisonValue.doubleValue() < _largestSeenComparisonValue - 
_metadataTTL) {
         _logger.info("Skip adding segment: {} because it's out of TTL", 
segmentName);
         MutableRoaringBitmap validDocIdsSnapshot = 
immutableSegment.loadValidDocIdsFromSnapshot();
         if (validDocIdsSnapshot != null) {
-          immutableSegment.enableUpsert(this, new 
ThreadSafeMutableRoaringBitmap(validDocIdsSnapshot), null);
+          ThreadSafeMutableRoaringBitmap queryableDocIds = null;
+          if (_deleteRecordColumn != null) {
+            queryableDocIds = new ThreadSafeMutableRoaringBitmap();
+          }
+          immutableSegment.enableUpsert(this, new 
ThreadSafeMutableRoaringBitmap(validDocIdsSnapshot), queryableDocIds);

Review Comment:
   thanks @Jackie-Jiang i realized the unit test might not cover this function, 
since we mocked segments and test addSegment(segment, null, null, 
recordInfoIterator) instead of `addSegment(segment)` after calling 
enableUpsert().
   
   let me think if there is a better approach to test this part.
   



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