Skip to content

Commit

Permalink
add parquet.(*File).Schema (parquet-go#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Achille authored Apr 20, 2022
1 parent 349e5bf commit 8dd96f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type File struct {
protocol thrift.CompactProtocol
reader io.ReaderAt
size int64
schema *Schema
root *Column
columnIndexes []format.ColumnIndex
offsetIndexes []format.OffsetIndex
Expand Down Expand Up @@ -87,6 +88,7 @@ func OpenFile(r io.ReaderAt, size int64, options ...FileOption) (*File, error) {

schema := NewSchema(f.root.Name(), f.root)
columns := make([]*Column, 0, MaxColumnIndex+1)
f.schema = schema
f.root.forEachLeaf(func(c *Column) { columns = append(columns, c) })

f.rowGroups = make([]fileRowGroup, len(f.metadata.RowGroups))
Expand Down Expand Up @@ -218,6 +220,9 @@ func (f *File) RowGroup(i int) RowGroup { return &f.rowGroups[i] }
// Root returns the root column of f.
func (f *File) Root() *Column { return f.root }

// Schema returns the schema of f.
func (f *File) Schema() *Schema { return f.schema }

// Size returns the size of f (in bytes).
func (f *File) Size() int64 { return f.size }

Expand Down

0 comments on commit 8dd96f2

Please sign in to comment.