tarun11Mavani commented on code in PR #16344: URL: https://github.com/apache/pinot/pull/16344#discussion_r2288492250
########## 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: @rohityadav1993 It's technically feasible but would introduce performance trade-offs. We can modify gatherStats() to use the compacted reader instead of the regular one to make it work. But inside the gatherStats(), we iterate over each row and reprocess it. This means that we are rebuilding stats for each column by reading each row. While in current implementation, I am reusing the stats collected in MutableColumnStatistics + direct dictionary access to build the stats for compacted segment columns. -- 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]
