zeroshade commented on a change in pull request #10379: URL: https://github.com/apache/arrow/pull/10379#discussion_r648390799
########## File path: go/parquet/internal/encoding/delta_bit_packing.go ########## @@ -0,0 +1,514 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package encoding + +import ( + "bytes" + "math" + "math/bits" + "reflect" + + "github.com/apache/arrow/go/arrow" + "github.com/apache/arrow/go/arrow/memory" + "github.com/apache/arrow/go/parquet" + "github.com/apache/arrow/go/parquet/internal/utils" + "golang.org/x/xerrors" +) + +// see the deltaBitPack encoder for a description of the encoding format that is +// used for delta-bitpacking. +type deltaBitPackDecoder struct { + decoder + + mem memory.Allocator + + usedFirst bool + bitdecoder *utils.BitReader + blockSize uint64 + currentBlockVals uint64 + miniBlocks uint64 + valsPerMini uint64 + currentMiniBlockVals uint64 + minDelta int64 + miniBlockIdx uint64 + + deltaBitWidths *memory.Buffer + deltaBitWidth byte + + lastVal int64 +} + +// returns the number of bytes read so far +func (d *deltaBitPackDecoder) bytesRead() int64 { + return d.bitdecoder.CurOffset() +} + +func (d *deltaBitPackDecoder) Allocator() memory.Allocator { return d.mem } + +// SetData sets in the data to be decoded and the expected number of values to decode Review comment: reworded, let me know your opinion on the new wording. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
