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


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/indexsegment/immutable/ImmutableSegmentImpl.java:
##########
@@ -283,31 +276,22 @@ public ThreadSafeMutableRoaringBitmap getValidDocIds() {
 
   @Override
   public GenericRow getRecord(int docId, GenericRow reuse) {
-    try {
-      if (_pinotSegmentRecordReader == null) {
-        _pinotSegmentRecordReader = new PinotSegmentRecordReader();
-        _pinotSegmentRecordReader.init(this);
-      }
-      _pinotSegmentRecordReader.getRecord(reuse, docId);
+    try (PinotSegmentRecordReader recordReader = new 
PinotSegmentRecordReader()) {

Review Comment:
   That's why we should avoid using it unless unavoidable (partial-upsert). 
When reading multiple records, we should create the record reader instead of 
using this method (mentioned in the javadoc).



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