Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions arrow/ipc/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"sort"
"unsafe"

"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/endian"
Expand All @@ -34,6 +35,7 @@ import (
// Magic string identifying an Apache Arrow file.
var Magic = []byte("ARROW1")


const (
currentMetadataVersion = MetadataV5
minMetadataVersion = MetadataV4
Expand Down Expand Up @@ -183,7 +185,8 @@ func fieldFromFB(field *flatbuf.Field, pos dictutils.FieldPos, memo *dictutils.M
o arrow.Field
)

o.Name = string(field.Name())
name := field.Name()
o.Name = unsafe.String(&name[0], len(name))
o.Nullable = field.Nullable()
o.Metadata, err = metadataFromFB(field)
if err != nil {
Expand Down Expand Up @@ -460,7 +463,7 @@ func (fv *fieldVisitor) visit(field arrow.Field) {
field.Type = dt.StorageType()
fv.visit(field)
fv.meta[ExtensionTypeKeyName] = dt.ExtensionName()
fv.meta[ExtensionMetadataKeyName] = string(dt.Serialize())
fv.meta[ExtensionMetadataKeyName] = dt.Serialize()

case *arrow.DictionaryType:
field.Type = dt.ValueType
Expand Down Expand Up @@ -986,8 +989,9 @@ func timeFromFB(data flatbuf.Time) (arrow.DataType, error) {

func timestampFromFB(data flatbuf.Timestamp) (arrow.DataType, error) {
unit := unitFromFB(data.Unit())
tz := string(data.Timezone())
return &arrow.TimestampType{Unit: unit, TimeZone: tz}, nil
tz := data.Timezone()
tzs := unsafe.String(&tz[0], len(tz))
return &arrow.TimestampType{Unit: unit, TimeZone: tzs}, nil
}

func dateFromFB(data flatbuf.Date) (arrow.DataType, error) {
Expand Down
Loading