github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/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  }