xitongsys / parquet-go

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

Convert binary to string #430

Closed hangxie closed 2 years ago

hangxie commented 2 years ago

Is there an existing function to convert binary to string, opposite to types.StrIntToBinary?

The example at https://github.com/xitongsys/parquet-go/blob/master/example/type.go#L98-L99 shows how to write decimal to parquet, but whenever read from parquet, it prints pure binary without proper interpretation, eg

$ go run ./tool/parquet-tools/ -cmd cat -file example/type.parquet  | jq  | grep Decimal | head -5
    "Decimal1": 12345,
    "Decimal2": 12345,
    "Decimal3": "������������",
    "Decimal4": "09",
    "Decimal5": 0,
hangxie commented 2 years ago

types.DECIMAL_BYTE_ARRAY_ToString is what I'm looking for.