mirror of
https://github.com/hanzoai/traces.git
synced 2026-11-03 04:05:45 +00:00
| datasource | package | from | to | | ---------- | -------------------------------- | ------------------------------------- | ------- | | go | github.com/parquet-go/parquet-go | v0.25.2-0.20251204015147-5ef078713eb7 | v0.26.4 | Signed-off-by: renovate-sh-app[bot] <219655108+renovate-sh-app[bot]@users.noreply.github.com> Co-authored-by: renovate-sh-app[bot] <219655108+renovate-sh-app[bot]@users.noreply.github.com>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package parquet
|
|
|
|
import (
|
|
"slices"
|
|
|
|
"github.com/parquet-go/parquet-go/encoding"
|
|
)
|
|
|
|
// computeUnencodedByteArraySize calculates the unencoded size of byte array data
|
|
// in a page, excluding 4-byte length prefixes.
|
|
func computeUnencodedByteArraySize(page Page) int64 {
|
|
values := page.Data()
|
|
if values.Kind() != encoding.ByteArray {
|
|
return 0
|
|
}
|
|
return values.Size()
|
|
}
|
|
|
|
// accumulateLevelHistogram adds level counts from levels to histogram.
|
|
func accumulateLevelHistogram(histogram []int64, levels []byte) {
|
|
for _, level := range levels {
|
|
histogram[level]++
|
|
}
|
|
}
|
|
|
|
// appendPageLevelHistogram creates a per-page histogram and appends it to histograms.
|
|
// Returns the updated histogram slice with (maxLevel + 1) new elements appended.
|
|
func appendPageLevelHistogram(histograms []int64, levels []byte, maxLevel byte) []int64 {
|
|
histSize := int(maxLevel) + 1
|
|
startIndex := len(histograms)
|
|
histograms = slices.Grow(histograms, histSize)[:startIndex+histSize]
|
|
|
|
for i := range histSize {
|
|
histograms[startIndex+i] = 0
|
|
}
|
|
|
|
for _, level := range levels {
|
|
histograms[startIndex+int(level)]++
|
|
}
|
|
|
|
return histograms
|
|
}
|