T - the Java type described by this Statistics instancepublic abstract class Statistics<T extends Comparable<T>> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Statistics.Builder
Builder class to build Statistics objects.
|
| Modifier and Type | Method and Description |
|---|---|
PrimitiveComparator<T> |
comparator()
Returns the
PrimitiveComparator implementation to be used to compare two generic values in the proper way
(for example, unsigned comparison for UINT_32). |
int |
compareMaxToValue(T value)
Compares max to the specified value in the proper way.
|
int |
compareMinToValue(T value)
Compares min to the specified value in the proper way.
|
abstract Statistics<T> |
copy() |
static Statistics<?> |
createStats(Type type)
Creates an empty
Statistics instance for the specified type to be
used for reading/writing the new min/max statistics used in the V2 format. |
boolean |
equals(Object other)
Equality comparison method to compare two statistics objects.
|
abstract T |
genericGetMax()
Returns the max value in the statistics.
|
abstract T |
genericGetMin()
Returns the min value in the statistics.
|
static Statistics.Builder |
getBuilderForReading(PrimitiveType type)
Returns a builder to create new statistics object.
|
abstract byte[] |
getMaxBytes()
Abstract method to return the max value as a byte array
|
abstract byte[] |
getMinBytes()
Abstract method to return the min value as a byte array
|
long |
getNumNulls()
Returns the null count
|
static Statistics |
getStatsBasedOnType(PrimitiveType.PrimitiveTypeName type)
Deprecated.
Use
createStats(Type) instead |
int |
hashCode()
Hash code for the statistics object
|
boolean |
hasNonNullValue()
Returns whether there have been non-null values added to this statistics
|
void |
incrementNumNulls()
Increments the null count by one
|
void |
incrementNumNulls(long increment)
Increments the null count by the parameter value
|
boolean |
isEmpty()
Returns a boolean specifying if the Statistics object is empty,
i.e does not contain valid statistics for the page/column yet
|
boolean |
isNumNullsSet() |
abstract boolean |
isSmallerThan(long size)
Abstract method to return whether the min and max values fit in the given
size.
|
protected void |
markAsNotEmpty()
Sets the page/column as having a valid non-null value
kind of misnomer here
|
String |
maxAsString()
Returns the string representation of max for debugging/logging purposes.
|
void |
mergeStatistics(Statistics stats)
Method to merge this statistics object with the object passed
as parameter.
|
protected abstract void |
mergeStatisticsMinMax(Statistics stats)
Abstract method to merge this statistics min and max with the values
of the parameter object.
|
String |
minAsString()
Returns the string representation of min for debugging/logging purposes.
|
abstract void |
setMinMaxFromBytes(byte[] minBytes,
byte[] maxBytes)
Deprecated.
will be removed in 2.0.0. Use
getBuilderForReading(PrimitiveType) instead. |
void |
setNumNulls(long nulls)
Deprecated.
will be removed in 2.0.0. Use
getBuilderForReading(PrimitiveType) instead. |
String |
toString() |
PrimitiveType |
type() |
void |
updateStats(Binary value)
updates statistics min and max using the passed value
|
void |
updateStats(boolean value)
updates statistics min and max using the passed value
|
void |
updateStats(double value)
updates statistics min and max using the passed value
|
void |
updateStats(float value)
updates statistics min and max using the passed value
|
void |
updateStats(int value)
updates statistics min and max using the passed value
|
void |
updateStats(long value)
updates statistics min and max using the passed value
|
@Deprecated public static Statistics getStatsBasedOnType(PrimitiveType.PrimitiveTypeName type)
createStats(Type) insteadtype - PrimitiveTypeName type of the columnpublic static Statistics<?> createStats(Type type)
Statistics instance for the specified type to be
used for reading/writing the new min/max statistics used in the V2 format.type - type of the columnpublic static Statistics.Builder getBuilderForReading(PrimitiveType type)
type - type of the columnpublic void updateStats(int value)
value - value to use to update min and maxpublic void updateStats(long value)
value - value to use to update min and maxpublic void updateStats(float value)
value - value to use to update min and maxpublic void updateStats(double value)
value - value to use to update min and maxpublic void updateStats(boolean value)
value - value to use to update min and maxpublic void updateStats(Binary value)
value - value to use to update min and maxpublic boolean equals(Object other)
public int hashCode()
public void mergeStatistics(Statistics stats)
stats - Statistics object to merge withprotected abstract void mergeStatisticsMinMax(Statistics stats)
stats - Statistics object to merge with@Deprecated public abstract void setMinMaxFromBytes(byte[] minBytes, byte[] maxBytes)
getBuilderForReading(PrimitiveType) instead.minBytes - byte array to set the min value tomaxBytes - byte array to set the max value topublic abstract T genericGetMin()
Comparable.compareTo(Object) might not be the proper one. For example, UINT_32 requires unsigned comparison instead of the
natural signed one. Use compareMinToValue(Comparable) or the comparator returned by comparator() to
always get the proper ordering.public abstract T genericGetMax()
Comparable.compareTo(Object) might not be the proper one. For example, UINT_32 requires unsigned comparison instead of the
natural signed one. Use compareMaxToValue(Comparable) or the comparator returned by comparator() to
always get the proper ordering.public final PrimitiveComparator<T> comparator()
PrimitiveComparator implementation to be used to compare two generic values in the proper way
(for example, unsigned comparison for UINT_32).public final int compareMinToValue(T value)
comparator().compare(genericGetMin(), value). The corresponding statistics implementations overload this
method so the one with the primitive argument shall be used to avoid boxing/unboxing.value - the value which min is to be compared tomin is less than, equal to, or greater than
value.public final int compareMaxToValue(T value)
comparator().compare(genericGetMax(), value). The corresponding statistics implementations overload this
method so the one with the primitive argument shall be used to avoid boxing/unboxing.value - the value which max is to be compared tomax is less than, equal to, or greater than
value.public abstract byte[] getMaxBytes()
public abstract byte[] getMinBytes()
public String minAsString()
public String maxAsString()
public abstract boolean isSmallerThan(long size)
size - a size in bytespublic void incrementNumNulls()
public void incrementNumNulls(long increment)
increment - value to increment the null count bypublic long getNumNulls()
-1 if the null count is not set@Deprecated public void setNumNulls(long nulls)
getBuilderForReading(PrimitiveType) instead.nulls - null count to set the count topublic boolean isEmpty()
public boolean hasNonNullValue()
public boolean isNumNullsSet()
protected void markAsNotEmpty()
public abstract Statistics<T> copy()
public PrimitiveType type()
Copyright © 2023 The Apache Software Foundation. All rights reserved.