Skip to content

Commit

Permalink
FieldNames function
Browse files Browse the repository at this point in the history
  • Loading branch information
loicalleyne committed Jan 17, 2025
1 parent 870cbba commit e134319
Show file tree
Hide file tree
Showing 3 changed files with 412 additions and 53 deletions.
13 changes: 12 additions & 1 deletion bufarrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,28 @@ func (s *Schema[T]) Parquet() *schema.Schema {
return s.msg.Parquet()
}

// Parquet returns schema as arrow schema
// Schema returns schema as arrow schema
func (s *Schema[T]) Schema() *arrow.Schema {
return s.msg.schema
}

// FieldNames returns top-level field names
func (s *Schema[T]) FieldNames() []string {
var fieldNames []string
fieldNames = make([]string, 0, len(s.msg.schema.Fields()))
for _, f := s.msg.schema.Fields() {
fieldNames = append(fieldNames, f.Name)
}
return fieldNames
}

// ReadParquet specified columns from parquet source r and returns an Arrow record. The returned record must
// be released by the caller.
func (s *Schema[T]) ReadParquet(ctx context.Context, r parquet.ReaderAtSeeker, columns []int) (arrow.Record, error) {
return s.msg.Read(ctx, r, columns)
}

// WriteParquet writes Parquet to an io.Writer
func (s *Schema[T]) WriteParquet(w io.Writer) error {
return s.msg.WriteParquet(w)
}
Expand Down
35 changes: 18 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
module github.com/loicalleyne/bufarrow

go 1.22.2
go 1.23.3

require (
github.com/apache/arrow-go/v18 v18.0.0
go.opentelemetry.io/proto/otlp v1.2.0
google.golang.org/protobuf v1.35.1
github.com/apache/arrow-go/v18 v18.1.0
github.com/confluentinc/confluent-kafka-go/v2 v2.8.0
go.opentelemetry.io/proto/otlp v1.5.0
google.golang.org/protobuf v1.36.3
)

require (
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/apache/thrift v0.21.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/goccy/go-json v0.10.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v24.3.25+incompatible // indirect
github.com/google/flatbuffers v24.12.23+incompatible // indirect
github.com/klauspost/asmfmt v1.3.2 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 // indirect
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 // indirect
github.com/pierrec/lz4/v4 v4.1.21 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/tools v0.26.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.67.1 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.29.0 // indirect
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect
google.golang.org/grpc v1.69.2 // indirect
)
Loading

0 comments on commit e134319

Please sign in to comment.