alexandreyc opened a new pull request, #13310:
URL: https://github.com/apache/arrow/pull/13310
Hello world,
When converting from Arrow to Parquet it looks like there is a bug with
arrays of type `arrow.NULL`. Here is a snippet of code to reproduce the bug:
```go
package main
import (
"fmt"
"log"
"os"
"github.com/apache/arrow/go/v9/arrow"
"github.com/apache/arrow/go/v9/arrow/array"
"github.com/apache/arrow/go/v9/arrow/memory"
"github.com/apache/arrow/go/v9/parquet/pqarrow"
)
const n = 10
func run() error {
schema := arrow.NewSchema(
[]arrow.Field{
{Name: "f1", Type: arrow.Null, Nullable: true},
},
nil,
)
rb := array.NewRecordBuilder(memory.DefaultAllocator, schema)
defer rb.Release()
for i := 0; i < n; i++ {
rb.Field(0).(*array.NullBuilder).AppendNull()
}
rec := rb.NewRecord()
defer rec.Release()
for i, col := range rec.Columns() {
fmt.Printf("column[%d] %q: %v\n", i, rec.ColumnName(i), col)
}
f, err := os.Create("output.parquet")
if err != nil {
return err
}
defer f.Close()
w, err := pqarrow.NewFileWriter(rec.Schema(), f, nil,
pqarrow.DefaultWriterProps())
if err != nil {
return err
}
defer w.Close()
err = w.Write(rec)
if err != nil {
return err
}
return nil
}
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
```
I'm not 100% sure if my fix is the best, so feel free to correct me.
Thanks
A
--
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]