github.com/parquet-go/parquet-go@v0.21.1-0.20240501160520-b3c3a0c3ed6f/page_bounds.go (about)

     1  package parquet
     2  
     3  import "bytes"
     4  
     5  func boundsFixedLenByteArray(data []byte, size int) (min, max []byte) {
     6  	if len(data) > 0 {
     7  		min = data[:size]
     8  		max = data[:size]
     9  
    10  		for i, j := size, 2*size; j <= len(data); {
    11  			item := data[i:j]
    12  
    13  			if bytes.Compare(item, min) < 0 {
    14  				min = item
    15  			}
    16  			if bytes.Compare(item, max) > 0 {
    17  				max = item
    18  			}
    19  
    20  			i += size
    21  			j += size
    22  		}
    23  	}
    24  	return min, max
    25  }