github.com/vc42/parquet-go@v0.0.0-20240320194221-1a9adb5f23f5/dictionary_amd64.go (about) 1 //go:build !purego 2 3 package parquet 4 5 import ( 6 "github.com/vc42/parquet-go/internal/unsafecast" 7 "github.com/vc42/parquet-go/sparse" 8 ) 9 10 //go:noescape 11 func dictionaryBoundsInt32(dict []int32, indexes []int32) (min, max int32, err errno) 12 13 //go:noescape 14 func dictionaryBoundsInt64(dict []int64, indexes []int32) (min, max int64, err errno) 15 16 //go:noescape 17 func dictionaryBoundsFloat32(dict []float32, indexes []int32) (min, max float32, err errno) 18 19 //go:noescape 20 func dictionaryBoundsFloat64(dict []float64, indexes []int32) (min, max float64, err errno) 21 22 //go:noescape 23 func dictionaryBoundsUint32(dict []uint32, indexes []int32) (min, max uint32, err errno) 24 25 //go:noescape 26 func dictionaryBoundsUint64(dict []uint64, indexes []int32) (min, max uint64, err errno) 27 28 //go:noescape 29 func dictionaryBoundsBE128(dict [][16]byte, indexes []int32) (min, max *[16]byte, err errno) 30 31 //go:noescape 32 func dictionaryLookup32(dict []uint32, indexes []int32, rows sparse.Array) errno 33 34 //go:noescape 35 func dictionaryLookup64(dict []uint64, indexes []int32, rows sparse.Array) errno 36 37 //go:noescape 38 func dictionaryLookupByteArrayString(dict []uint32, page []byte, indexes []int32, rows sparse.Array) errno 39 40 //go:noescape 41 func dictionaryLookupFixedLenByteArrayString(dict []byte, len int, indexes []int32, rows sparse.Array) errno 42 43 //go:noescape 44 func dictionaryLookupFixedLenByteArrayPointer(dict []byte, len int, indexes []int32, rows sparse.Array) errno 45 46 func (d *int32Dictionary) lookup(indexes []int32, rows sparse.Array) { 47 checkLookupIndexBounds(indexes, rows) 48 dict := unsafecast.Int32ToUint32(d.values) 49 dictionaryLookup32(dict, indexes, rows).check() 50 } 51 52 func (d *int64Dictionary) lookup(indexes []int32, rows sparse.Array) { 53 checkLookupIndexBounds(indexes, rows) 54 dict := unsafecast.Int64ToUint64(d.values) 55 dictionaryLookup64(dict, indexes, rows).check() 56 } 57 58 func (d *floatDictionary) lookup(indexes []int32, rows sparse.Array) { 59 checkLookupIndexBounds(indexes, rows) 60 dict := unsafecast.Float32ToUint32(d.values) 61 dictionaryLookup32(dict, indexes, rows).check() 62 } 63 64 func (d *doubleDictionary) lookup(indexes []int32, rows sparse.Array) { 65 checkLookupIndexBounds(indexes, rows) 66 dict := unsafecast.Float64ToUint64(d.values) 67 dictionaryLookup64(dict, indexes, rows).check() 68 } 69 70 func (d *byteArrayDictionary) lookupString(indexes []int32, rows sparse.Array) { 71 checkLookupIndexBounds(indexes, rows) 72 dictionaryLookupByteArrayString(d.offsets, d.values, indexes, rows).check() 73 } 74 75 func (d *fixedLenByteArrayDictionary) lookupString(indexes []int32, rows sparse.Array) { 76 checkLookupIndexBounds(indexes, rows) 77 dictionaryLookupFixedLenByteArrayString(d.data, d.size, indexes, rows).check() 78 } 79 80 func (d *uint32Dictionary) lookup(indexes []int32, rows sparse.Array) { 81 checkLookupIndexBounds(indexes, rows) 82 dictionaryLookup32(d.values, indexes, rows).check() 83 } 84 85 func (d *uint64Dictionary) lookup(indexes []int32, rows sparse.Array) { 86 checkLookupIndexBounds(indexes, rows) 87 dictionaryLookup64(d.values, indexes, rows).check() 88 } 89 90 func (d *be128Dictionary) lookupString(indexes []int32, rows sparse.Array) { 91 checkLookupIndexBounds(indexes, rows) 92 dict := unsafecast.Uint128ToBytes(d.values) 93 dictionaryLookupFixedLenByteArrayString(dict, 16, indexes, rows).check() 94 } 95 96 func (d *be128Dictionary) lookupPointer(indexes []int32, rows sparse.Array) { 97 checkLookupIndexBounds(indexes, rows) 98 dict := unsafecast.Uint128ToBytes(d.values) 99 dictionaryLookupFixedLenByteArrayPointer(dict, 16, indexes, rows).check() 100 } 101 102 func (d *int32Dictionary) bounds(indexes []int32) (min, max int32) { 103 min, max, err := dictionaryBoundsInt32(d.values, indexes) 104 err.check() 105 return min, max 106 } 107 108 func (d *int64Dictionary) bounds(indexes []int32) (min, max int64) { 109 min, max, err := dictionaryBoundsInt64(d.values, indexes) 110 err.check() 111 return min, max 112 } 113 114 func (d *floatDictionary) bounds(indexes []int32) (min, max float32) { 115 min, max, err := dictionaryBoundsFloat32(d.values, indexes) 116 err.check() 117 return min, max 118 } 119 120 func (d *doubleDictionary) bounds(indexes []int32) (min, max float64) { 121 min, max, err := dictionaryBoundsFloat64(d.values, indexes) 122 err.check() 123 return min, max 124 } 125 126 func (d *uint32Dictionary) bounds(indexes []int32) (min, max uint32) { 127 min, max, err := dictionaryBoundsUint32(d.values, indexes) 128 err.check() 129 return min, max 130 } 131 132 func (d *uint64Dictionary) bounds(indexes []int32) (min, max uint64) { 133 min, max, err := dictionaryBoundsUint64(d.values, indexes) 134 err.check() 135 return min, max 136 } 137 138 func (d *be128Dictionary) bounds(indexes []int32) (min, max *[16]byte) { 139 min, max, err := dictionaryBoundsBE128(d.values, indexes) 140 err.check() 141 return min, max 142 }