github.com/segmentio/parquet-go@v0.0.0-20230712180008-5d42db8f0d47/sparse/gather.go (about) 1 package sparse 2 3 import "unsafe" 4 5 func GatherInt32(dst []int32, src Int32Array) int { 6 return GatherUint32(*(*[]uint32)(unsafe.Pointer(&dst)), src.Uint32Array()) 7 } 8 9 func GatherInt64(dst []int64, src Int64Array) int { 10 return GatherUint64(*(*[]uint64)(unsafe.Pointer(&dst)), src.Uint64Array()) 11 } 12 13 func GatherFloat32(dst []float32, src Float32Array) int { 14 return GatherUint32(*(*[]uint32)(unsafe.Pointer(&dst)), src.Uint32Array()) 15 } 16 17 func GatherFloat64(dst []float64, src Float64Array) int { 18 return GatherUint64(*(*[]uint64)(unsafe.Pointer(&dst)), src.Uint64Array()) 19 } 20 21 func GatherBits(dst []byte, src Uint8Array) int { return gatherBits(dst, src) } 22 23 func GatherUint32(dst []uint32, src Uint32Array) int { return gather32(dst, src) } 24 25 func GatherUint64(dst []uint64, src Uint64Array) int { return gather64(dst, src) } 26 27 func GatherUint128(dst [][16]byte, src Uint128Array) int { return gather128(dst, src) } 28 29 func GatherString(dst []string, src StringArray) int { 30 n := min(len(dst), src.Len()) 31 32 for i := range dst[:n] { 33 dst[i] = src.Index(i) 34 } 35 36 return n 37 } 38 39 func min(a, b int) int { 40 if a < b { 41 return a 42 } 43 return b 44 }