You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Matthew Topol (Jira)" <ji...@apache.org> on 2022/06/10 17:59:00 UTC

[jira] [Resolved] (ARROW-16749) [Go] Bug when converting from Arrow to Parquet from null array

     [ https://issues.apache.org/jira/browse/ARROW-16749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthew Topol resolved ARROW-16749.
-----------------------------------
    Fix Version/s: 9.0.0
       Resolution: Fixed

Issue resolved by pull request 13310
[https://github.com/apache/arrow/pull/13310]

> [Go] Bug when converting from Arrow to Parquet from null array
> --------------------------------------------------------------
>
>                 Key: ARROW-16749
>                 URL: https://issues.apache.org/jira/browse/ARROW-16749
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Go
>    Affects Versions: 9.0.0
>            Reporter: Alexandre Crayssac
>            Assignee: Alexandre Crayssac
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 9.0.0
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> 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:
>  
> {code:java}
> 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)
> 	}
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)