xitongsys / parquet-go

pure golang library for reading/writing parquet file
Apache License 2.0
1.27k stars 293 forks source link

Fix not being able to encode byte slice #366

Closed lbjarre closed 3 years ago

lbjarre commented 3 years ago

This patch introduces a check when marshalling a interface type based on the INT32 parquet type by defensively checking if it's a uint8, and therefore handling the byte case without panicing.

Added a simple test case to cover the intended usecase.

Handles some of the issues raised in #321, though more convenient encoding of a byte slice as a BYTE_ARRAY might be better.

lbjarre commented 3 years ago

Sorry, managed to push all of the formatting changes but not the actual code change. Force pushed with the actual update.

xitongsys commented 3 years ago

this change may not be a general way to support byte array. I'm considering to support it. Anyway, thanks !

ArunanSivanathan commented 7 months ago

I faced same issue recently #582. But this implementation is going to have each byte as int32 correct? Don't you think this is an in efficient way to store a single byte in 4 byte integer format?

Please correct me if I'm wrong.