zeroshade commented on code in PR #38367:
URL: https://github.com/apache/arrow/pull/38367#discussion_r1372311882


##########
go/parquet/internal/encoding/boolean_encoder.go:
##########
@@ -87,3 +89,53 @@ func (enc *PlainBooleanEncoder) FlushValues() (Buffer, 
error) {
 
        return enc.sink.Finish(), nil
 }
+
+type RleBooleanEncoder struct {
+       encoder
+
+       bufferedValues []bool
+}
+
+func (RleBooleanEncoder) Type() parquet.Type {
+       return parquet.Types.Boolean
+}
+
+func (enc *RleBooleanEncoder) Put(in []bool) {
+       enc.bufferedValues = append(enc.bufferedValues, in...)
+}
+
+func (enc *RleBooleanEncoder) PutSpaced(in []bool, validBits []byte, 
validBitsOffset int64) {
+       bufferOut := make([]bool, len(in))
+       nvalid := spacedCompress(in, bufferOut, validBits, validBitsOffset)
+       enc.Put(bufferOut[:nvalid])
+}
+
+func (enc *RleBooleanEncoder) EstimatedDataEncodedSize() int64 {
+       const rleLengthInBytes = 4
+       return rleLengthInBytes + int64(enc.maxRleBufferSize())
+}
+
+func (enc *RleBooleanEncoder) maxRleBufferSize() int {
+       return utils.MaxBufferSize(1, len(enc.bufferedValues))

Review Comment:
   renamed the functions



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to