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

     1  // Copyright 2022 Twilio Inc.
     2  
     3  // Package parquet is a library for working with parquet files. For an overview
     4  // of Parquet's qualities as a storage format, see this blog post:
     5  // https://blog.twitter.com/engineering/en_us/a/2013/dremel-made-simple-with-parquet
     6  //
     7  // Or see the Parquet documentation: https://parquet.apache.org/docs/
     8  package parquet
     9  
    10  import "reflect"
    11  
    12  func atLeastOne(size int) int {
    13  	return atLeast(size, 1)
    14  }
    15  
    16  func atLeast(size, least int) int {
    17  	if size < least {
    18  		return least
    19  	}
    20  	return size
    21  }
    22  
    23  func min(a, b int) int {
    24  	if a < b {
    25  		return a
    26  	}
    27  	return b
    28  }
    29  
    30  func max(a, b int) int {
    31  	if a > b {
    32  		return a
    33  	}
    34  	return b
    35  }
    36  
    37  func typeNameOf(t reflect.Type) string {
    38  	s1 := t.String()
    39  	s2 := t.Kind().String()
    40  	if s1 == s2 {
    41  		return s1
    42  	}
    43  	return s1 + " (" + s2 + ")"
    44  }
    45  
    46  func isZero(b []byte) bool {
    47  	for _, c := range b {
    48  		if c != 0 {
    49  			return false
    50  		}
    51  	}
    52  	return true
    53  }