Class SizeStatistics
- java.lang.Object
-
- org.apache.parquet.column.statistics.SizeStatistics
-
public class SizeStatistics extends Object
A structure for capturing metadata for estimating the unencoded, uncompressed size of data written. This is useful for readers to estimate how much memory is needed to reconstruct data in their memory model and for fine-grained filter push down on nested structures (the histograms contained in this structure can help determine the number of nulls at a particular nesting level and maximum length of lists).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSizeStatistics.BuilderBuilder to create a SizeStatistics.
-
Constructor Summary
Constructors Constructor Description SizeStatistics(PrimitiveType type, long unencodedByteArrayDataBytes, List<Long> repetitionLevelHistogram, List<Long> definitionLevelHistogram)Create a SizeStatistics.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SizeStatisticscopy()List<Long>getDefinitionLevelHistogram()Same as repetition_level_histogram except for definition levels.List<Long>getRepetitionLevelHistogram()When present, there is expected to be one element corresponding to each repetition (i.e. size=max repetition_level+1) where each element represents the number of times the repetition level was observed in the data.PrimitiveTypegetType()Optional<Long>getUnencodedByteArrayDataBytes()The number of physical bytes stored for BYTE_ARRAY data values assuming no encoding.booleanisValid()voidmergeStatistics(SizeStatistics other)Merge two SizeStatistics of the same column.static SizeStatistics.BuildernewBuilder(PrimitiveType type, int maxRepetitionLevel, int maxDefinitionLevel)Create a builder to create a SizeStatistics.static SizeStatistics.BuildernoopBuilder(PrimitiveType type, int maxRepetitionLevel, int maxDefinitionLevel)Creates a builder that doesn't collect any statistics.
-
-
-
Constructor Detail
-
SizeStatistics
public SizeStatistics(PrimitiveType type, long unencodedByteArrayDataBytes, List<Long> repetitionLevelHistogram, List<Long> definitionLevelHistogram)
Create a SizeStatistics.- Parameters:
type- physical type of the column associated with this statisticsunencodedByteArrayDataBytes- number of physical bytes stored for BYTE_ARRAY data values assuming no encodingrepetitionLevelHistogram- histogram for all repetition levels if non-emptydefinitionLevelHistogram- histogram for all definition levels if non-empty
-
-
Method Detail
-
newBuilder
public static SizeStatistics.Builder newBuilder(PrimitiveType type, int maxRepetitionLevel, int maxDefinitionLevel)
Create a builder to create a SizeStatistics.- Parameters:
type- physical type of the column associated with this statisticsmaxRepetitionLevel- maximum repetition level of the columnmaxDefinitionLevel- maximum definition level of the column
-
mergeStatistics
public void mergeStatistics(SizeStatistics other)
Merge two SizeStatistics of the same column. It is used to merge size statistics from all pages of the same column chunk.
-
getType
public PrimitiveType getType()
-
getUnencodedByteArrayDataBytes
public Optional<Long> getUnencodedByteArrayDataBytes()
The number of physical bytes stored for BYTE_ARRAY data values assuming no encoding. This is exclusive of the bytes needed to store the length of each byte array. In other words, this field is equivalent to the `(size of PLAIN-ENCODING the byte array values) - (4 bytes * number of values written)`. To determine unencoded sizes of other types readers can use schema information multiplied by the number of non-null and null values. The number of null/non-null values can be inferred from the histograms below. For example, if a column chunk is dictionary-encoded with dictionary ["a", "bc", "cde"], and a data page contains the indices [0, 0, 1, 2], then this value for that data page should be 7 (1 + 1 + 2 + 3). This field should only be set for types that use BYTE_ARRAY as their physical type. It represents the field `unencoded_byte_array_data_bytes` in theSizeStatistics- Returns:
- unencoded and uncompressed byte size of the BYTE_ARRAY column, or empty for other types.
-
getRepetitionLevelHistogram
public List<Long> getRepetitionLevelHistogram()
When present, there is expected to be one element corresponding to each repetition (i.e. size=max repetition_level+1) where each element represents the number of times the repetition level was observed in the data. This field may be omitted if max_repetition_level is 0 without loss of information. It represents the field `repetition_level_histogram` in theSizeStatistics- Returns:
- repetition level histogram of all levels if not empty.
-
getDefinitionLevelHistogram
public List<Long> getDefinitionLevelHistogram()
Same as repetition_level_histogram except for definition levels. This field may be omitted if max_definition_level is 0 or 1 without loss of information. It represents the field `definition_level_histogram` in theSizeStatistics- Returns:
- definition level histogram of all levels if not empty.
-
copy
public SizeStatistics copy()
- Returns:
- a new independent statistics instance of this class.
-
isValid
public boolean isValid()
- Returns:
- whether the statistics has valid value.
-
noopBuilder
public static SizeStatistics.Builder noopBuilder(PrimitiveType type, int maxRepetitionLevel, int maxDefinitionLevel)
Creates a builder that doesn't collect any statistics.
-
-