xiangfu0 commented on code in PR #18170: URL: https://github.com/apache/pinot/pull/18170#discussion_r3069004847
########## pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/stats/EmptyColumnStatistics.java: ########## @@ -0,0 +1,121 @@ +/** + * 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.creator.impl.stats; + +import java.util.Map; +import java.util.Set; +import javax.annotation.Nullable; +import org.apache.pinot.segment.spi.creator.ColumnStatistics; +import org.apache.pinot.segment.spi.partition.PartitionFunction; +import org.apache.pinot.spi.data.FieldSpec; +import org.apache.pinot.spi.data.FieldSpec.DataType; + + +/// Column statistics for an empty column (zero rows). +@SuppressWarnings("rawtypes") +public class EmptyColumnStatistics implements ColumnStatistics { + private final FieldSpec _fieldSpec; + + public EmptyColumnStatistics(FieldSpec fieldSpec) { + _fieldSpec = fieldSpec; + } + + @Override + public FieldSpec getFieldSpec() { + return _fieldSpec; + } + + @Nullable + @Override + public Comparable getMinValue() { + return null; + } + + @Nullable + @Override + public Comparable getMaxValue() { + return null; + } + + @Nullable + @Override + public Object getUniqueValuesSet() { + return null; + } + + @Override + public int getCardinality() { + return 0; + } + + @Override + public int getLengthOfShortestElement() { + DataType valueType = getValueType(); + return valueType.isFixedWidth() ? valueType.size() : 0; + } + + @Override + public int getLengthOfLongestElement() { + DataType valueType = getValueType(); + return valueType.isFixedWidth() ? valueType.size() : 0; + } + + @Override + public boolean isSorted() { + return isSingleValue(); + } + + @Override + public int getTotalNumberOfEntries() { + return 0; + } + + @Override + public int getMaxNumberOfMultiValues() { + return 0; + } + + @Override + public int getMaxRowLengthInBytes() { + return 0; + } + + @Nullable + @Override + public PartitionFunction getPartitionFunction() { Review Comment: do we need to keep the partition info? Will this cause regression for segment pruning or table rebalance? -- 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]
