github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/page_min.go (about)

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