rohityadav1993 commented on code in PR #16344: URL: https://github.com/apache/pinot/pull/16344#discussion_r2287851695
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/converter/stats/CompactedDictEncodedColumnStatistics.java: ########## @@ -0,0 +1,161 @@ +/** + * 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.realtime.converter.stats; + +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.pinot.segment.spi.datasource.DataSource; +import org.apache.pinot.segment.spi.index.mutable.MutableForwardIndex; +import org.apache.pinot.segment.spi.index.mutable.ThreadSafeMutableRoaringBitmap; +import org.apache.pinot.segment.spi.index.reader.Dictionary; +import org.roaringbitmap.PeekableIntIterator; + + +/** + * Column statistics for dictionary columns with dictionary-encoded forward indexes. + * Uses direct getDictId() calls for single-value columns and getDictIdMV() calls for multi-value columns + * to find which dictionary entries are used by valid documents. + * + * This is used when: + * - Column has a dictionary (dataSource.getDictionary() != null) + * - Forward index is dictionary-encoded (forwardIndex.isDictionaryEncoded() == true) + * - Commit-time compaction is enabled + */ +public class CompactedDictEncodedColumnStatistics extends MutableColumnStatistics { Review Comment: There is a class which may be useful with minor tweaks(pass validDocIds) to collect stats: SegmentPreIndexStatsCollectorImpl. This is used by RecordReaderSegmentCreationDataSource.gatherStats() @tarun11Mavani, can you check if this can be reused. The current approach is fine as it isolates all the changes in one place unless the above suggested doesn't require major/complex code changes -- 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]
