Package io.delta.kernel.internal.stats
Class FileSizeHistogram
Object
io.delta.kernel.internal.stats.FileSizeHistogram
A histogram that tracks file size distributions and their counts.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileSizeHistogram(long[] sortedBinBoundaries, long[] fileCounts, long[] totalBytes) -
Method Summary
Modifier and TypeMethodDescriptionstatic FileSizeHistogramCreates a default FileSizeHistogram with predefined bin boundaries and zero counts.booleanstatic Optional<FileSizeHistogram> fromColumnVector(ColumnVector vector, int rowId) Creates a FileSizeHistogram from a column vector.static FileSizeHistogramfromFileSizeHistogramResult(FileSizeHistogramResult fileSizeHistogramResult) inthashCode()voidinsert(long fileSize) Adds a file size to the histogram, incrementing the appropriate bin's count and total bytes.minus(FileSizeHistogram other) Subtracts another histogram from this one.plus(FileSizeHistogram other) Adds two histograms together by combining their counts and total bytes.voidremove(long fileSize) Removes a file size from the histogram, decrementing the appropriate bin's count and total bytes.toRow()Encode as aRowobject with the schemaFULL_SCHEMA.
-
Field Details
-
FULL_SCHEMA
-
-
Constructor Details
-
FileSizeHistogram
@VisibleForTesting public FileSizeHistogram(long[] sortedBinBoundaries, long[] fileCounts, long[] totalBytes)
-
-
Method Details
-
createDefaultHistogram
Creates a default FileSizeHistogram with predefined bin boundaries and zero counts. -
fromColumnVector
Creates a FileSizeHistogram from a column vector. -
fromFileSizeHistogramResult
public static FileSizeHistogram fromFileSizeHistogramResult(FileSizeHistogramResult fileSizeHistogramResult) -
insert
public void insert(long fileSize) Adds a file size to the histogram, incrementing the appropriate bin's count and total bytes. The appropriate bin refers to a bin with boundary that is less than or equal to the file size. Files larger than the maximum bin boundary (256 GB) are placed in the last bin.- Parameters:
fileSize- The size of the file in bytes- Throws:
IllegalArgumentException- if fileSize is negative or if getBinIndex returns an invalid index
-
remove
public void remove(long fileSize) Removes a file size from the histogram, decrementing the appropriate bin's count and total bytes.- Parameters:
fileSize- The size of the file in bytes- Throws:
IllegalArgumentException- if fileSize is negative
-
toRow
Encode as aRowobject with the schemaFULL_SCHEMA. -
captureFileSizeHistogramResult
-
plus
Adds two histograms together by combining their counts and total bytes. Both histograms must have the same bin boundaries.- Parameters:
other- The histogram to add to this histogram- Returns:
- A new histogram with combined statistics
- Throws:
IllegalArgumentException- if the histograms have different bin boundaries
-
minus
Subtracts another histogram from this one. Both histograms must have the same bin boundaries. The result will ensure no negative counts or bytes.- Parameters:
other- The histogram to subtract from this histogram- Returns:
- A new histogram with the difference in statistics
- Throws:
IllegalArgumentException- if the histograms have different bin boundariesIllegalArgumentException- if subtraction would result in negative counts or bytes
-
equals
-
hashCode
public int hashCode()
-