joechenrh commented on code in PR #485:
URL: https://github.com/apache/arrow-go/pull/485#discussion_r2311724505


##########
parquet/internal/encoding/typed_encoder.go:
##########
@@ -556,6 +572,36 @@ func (enc *DictByteArrayEncoder) Type() parquet.Type {
        return parquet.Types.ByteArray
 }
 
+// ByteArrayDecoderWrapper is a wrapper around a ByteArrayDecoder that ensures
+// that the decoded byte arrays are copied into a new, contiguous buffer.
+type ByteArrayDecoderWrapper struct {
+       ByteArrayDecoder
+}
+
+func (d *ByteArrayDecoderWrapper) Decode(out []parquet.ByteArray) (int, error) 
{
+       n, err := d.ByteArrayDecoder.Decode(out)
+       if err != nil {
+               return n, err
+       }
+       cloneByteArray(out[:n])
+       return n, nil

Review Comment:
   Because there are several different encoder for `ByteArray` type, comparing 
to modify every implementation, I prefer add a wrapper for this work. Besides, 
by only applying the wrapper to page reader (which the target of this PR), we 
can ensure that other part of the code won't be affected by this additional 
overhead.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to