rohityadav1993 commented on code in PR #11826: URL: https://github.com/apache/pinot/pull/11826#discussion_r1365246548
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/readers/LazyRow.java: ########## @@ -0,0 +1,83 @@ +/** + * 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.local.segment.readers; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Set; +import org.apache.pinot.segment.spi.IndexSegment; + + +/** + * A wrapper class to read column values of a row for a given {@link IndexSegment} and docId.<br> + * The advantage of having wrapper over segment and docId is column values are read only when + * {@link LazyRow#getValue(String)} is invoked. + * This is useful to reduce the disk reads incurred due to loading the previous row during merge step. + * There isn't any advantage to have a LazyRow wrap a GenericRow but has been kept for syntactic sugar. + */ +public class LazyRow { + private IndexSegment _segment; Review Comment: Can make `_fieldToValueMap` final. Did not make the _segment final for the following reason: A row is uniquely identified by IndexSegment and docId. If we make `_segment` final then we need to keep a mapping of IndexSegment to LazyRow if we want to reuse the LazyRow object and the mapping will be kept in each `ConcurrentMapPartitionUpsertMetadataManager`. In this PR, we can reuse a single LazyRow object since we re-init LazyRow before each `doUpdateRecord` call. ``` _reusePreviousRow.init(currentSegment, currentDocId); _partialUpsertHandler.merge(_reusePreviousRow, record); ``` -- 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]
