xitongsys / parquet-go

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

WriteDeltaINT64 Bug !!! #477

Open adhamelia opened 2 years ago

adhamelia commented 2 years ago

Guys,

it seems like WriteDeltaINT64 has a bug. when we write random int64 values having size >18. decoding gives negative and corrupted values.

package main

import ( bytes2 "bytes" "github.com/xitongsys/parquet-go/encoding" "math/rand" )

func main() {

vals := make([]interface{}, 20)

for i := 0; i < len(vals); i++ {

    vals[i] = rand.Int63()
}

bytes := encoding.WriteDeltaINT64(vals)

vals1, _ := encoding.ReadDeltaBinaryPackedINT64(bytes2.NewReader(bytes))

println(len(vals1))

/// vals1[19] and vals1[18] are incorrect values... upto vale1[17] values are okey.... }

any idea ??? @xitongsys