Skip to content

Commit d8440ed

Browse files
Use SIMD implementations if available
1 parent 8895399 commit d8440ed

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

parquet/internal/encoding/byte_stream_split_amd64.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import (
2828

2929
func init() {
3030
if cpu.X86.HasAVX2 {
31+
decodeByteStreamSplitBatchWidth4 = decodeByteStreamSplitBatchWidth4AVX2
32+
decodeByteStreamSplitBatchWidth8 = decodeByteStreamSplitBatchWidth8AVX2
3133
}
3234
}
3335

parquet/internal/encoding/byte_stream_split_arm64.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import (
2828

2929
func init() {
3030
if cpu.ARM64.HasASIMD {
31+
decodeByteStreamSplitBatchWidth4 = decodeByteStreamSplitBatchWidth4NEON
32+
decodeByteStreamSplitBatchWidth8 = decodeByteStreamSplitBatchWidth8NEON
3133
}
3234
}
3335

parquet/internal/encoding/byte_stream_split_decode.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ import (
2525
)
2626

2727
var (
28-
decodeByteStreamSplitBatchWidth4 func(data []byte, nValues, stride int, out []byte) = decodeByteStreamSplitBatchWidth4Default
29-
decodeByteStreamSplitBatchWidth8 func(data []byte, nValues, stride int, out []byte) = decodeByteStreamSplitBatchWidth8Default
30-
decodeByteStreamSplitBatchFLBAWidth2 func(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) = decodeByteStreamSplitBatchFLBAWidth2Default
31-
decodeByteStreamSplitBatchFLBAWidth4 func(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) = decodeByteStreamSplitBatchFLBAWidth4Default
32-
decodeByteStreamSplitBatchFLBAWidth8 func(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) = decodeByteStreamSplitBatchFLBAWidth8Default
28+
decodeByteStreamSplitBatchWidth4 func(data []byte, nValues, stride int, out []byte) = decodeByteStreamSplitBatchWidth4Default
29+
decodeByteStreamSplitBatchWidth8 func(data []byte, nValues, stride int, out []byte) = decodeByteStreamSplitBatchWidth8Default
3330
)
3431

3532
// decodeByteStreamSplitBatchWidth4 decodes the batch of nValues raw bytes representing a 4-byte datatype provided by 'data',
@@ -90,7 +87,7 @@ func decodeByteStreamSplitBatchFLBA(data []byte, nValues, stride, width int, out
9087
// decodeByteStreamSplitBatchFLBAWidth2 decodes the batch of nValues FixedLenByteArrays of length 2 provided by 'data',
9188
// into the output slice 'out' using BYTE_STREAM_SPLIT encoding.
9289
// 'out' must have space for at least nValues slices.
93-
func decodeByteStreamSplitBatchFLBAWidth2Default(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) {
90+
func decodeByteStreamSplitBatchFLBAWidth2(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) {
9491
const width = 2
9592
debug.Assert(len(out) >= nValues, fmt.Sprintf("not enough space in output slice for decoding, out: %d values, data: %d values", len(out), nValues))
9693
debug.Assert(len(data) >= width*stride, fmt.Sprintf("not enough data for decoding, data: %d bytes, expected at least: %d bytes", len(data), width*stride))
@@ -105,7 +102,7 @@ func decodeByteStreamSplitBatchFLBAWidth2Default(data []byte, nValues, stride in
105102
// decodeByteStreamSplitBatchFLBAWidth4 decodes the batch of nValues FixedLenByteArrays of length 4 provided by 'data',
106103
// into the output slice 'out' using BYTE_STREAM_SPLIT encoding.
107104
// 'out' must have space for at least nValues slices.
108-
func decodeByteStreamSplitBatchFLBAWidth4Default(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) {
105+
func decodeByteStreamSplitBatchFLBAWidth4(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) {
109106
const width = 4
110107
debug.Assert(len(out) >= nValues, fmt.Sprintf("not enough space in output slice for decoding, out: %d values, data: %d values", len(out), nValues))
111108
debug.Assert(len(data) >= width*stride, fmt.Sprintf("not enough data for decoding, data: %d bytes, expected at least: %d bytes", len(data), width*stride))
@@ -122,7 +119,7 @@ func decodeByteStreamSplitBatchFLBAWidth4Default(data []byte, nValues, stride in
122119
// decodeByteStreamSplitBatchFLBAWidth8 decodes the batch of nValues FixedLenByteArrays of length 8 provided by 'data',
123120
// into the output slice 'out' using BYTE_STREAM_SPLIT encoding.
124121
// 'out' must have space for at least nValues slices.
125-
func decodeByteStreamSplitBatchFLBAWidth8Default(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) {
122+
func decodeByteStreamSplitBatchFLBAWidth8(data []byte, nValues, stride int, out []parquet.FixedLenByteArray) {
126123
const width = 8
127124
debug.Assert(len(out) >= nValues, fmt.Sprintf("not enough space in output slice for decoding, out: %d values, data: %d values", len(out), nValues))
128125
debug.Assert(len(data) >= width*stride, fmt.Sprintf("not enough data for decoding, data: %d bytes, expected at least: %d bytes", len(data), width*stride))

0 commit comments

Comments
 (0)