shachibista opened a new issue, #365:
URL: https://github.com/apache/arrow-go/issues/365

   ### Describe the enhancement requested
   
   Field level metadata on arrow schema is not persisted into the parquet 
files. 
   
   Here's a test script:
   
   ```golang
   package main
   
   import (
        "fmt"
        "os"
   
        "github.com/apache/arrow-go/v18/arrow"
        "github.com/apache/arrow-go/v18/arrow/array"
        "github.com/apache/arrow-go/v18/arrow/memory"
        "github.com/apache/arrow-go/v18/parquet"
        "github.com/apache/arrow-go/v18/parquet/compress"
        "github.com/apache/arrow-go/v18/parquet/pqarrow"
   )
   
   func main() {
        schema := arrow.NewSchema([]arrow.Field{
                {Name: "id", Type: arrow.BinaryTypes.Binary, Metadata: 
arrow.MetadataFrom(map[string]string{
                        "external_type": "uuid",
                })},
                {Name: "name", Type: arrow.BinaryTypes.String},
        }, nil)
   
        out, err := os.Create("test.parquet")
        if err != nil {
                fmt.Println(err)
                return
        }
   
        wr, err := pqarrow.NewFileWriter(
                schema,
                out,
                parquet.NewWriterProperties(
                        parquet.WithCompression(compress.Codecs.Snappy),
                        parquet.WithDataPageVersion(parquet.DataPageV2),
                        parquet.WithVersion(parquet.V2_LATEST),
                ),
                pqarrow.DefaultWriterProps(),
        )
        if err != nil {
                fmt.Println(err)
                return
        }
        defer wr.Close()
   
        rb := array.NewRecordBuilder(memory.DefaultAllocator, schema)
        defer rb.Release()
   
        rb.Field(0).AppendNull()
        rb.Field(1).AppendNull()
   
        wr.Write(rb.NewRecord())
   }
   ```
   
   ```python
   import pyarrow.parquet as pq
   
   table = pq.read_table("test.parquet")
   field = table.schema.field("id")
   print(field.metadata)  # prints None
   ```
   
   ### Component(s)
   
   Parquet


-- 
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: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to