Skip to content

Commit

Permalink
Add file path to reading error (#918)
Browse files Browse the repository at this point in the history
This adds some more context to what exactly is failing to open. Especially helpful for knowing which blocks my be broken.
  • Loading branch information
metalmatze authored Jul 9, 2024
1 parent 6206acd commit defafee
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dynparquet/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type SerializedBuffer struct {
func ReaderFromBytes(buf []byte) (*SerializedBuffer, error) {
f, err := parquet.OpenFile(bytes.NewReader(buf), int64(len(buf)))
if err != nil {
return nil, err
return nil, fmt.Errorf("error opening file from buffer: %w", err)
}

return NewSerializedBuffer(f)
Expand Down
2 changes: 1 addition & 1 deletion pqarrow/parquet.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func SerializeRecord(r arrow.Record, schema *dynparquet.Schema) (*dynparquet.Ser
}
f, err := parquet.OpenFile(bytes.NewReader(b.Bytes()), int64(b.Len()))
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to read buf: %v", err)
}
buf, err := dynparquet.NewSerializedBuffer(f)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion storage/iceberg.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func (i *Iceberg) Scan(ctx context.Context, prefix string, _ *dynparquet.Schema,
parquet.FileReadMode(parquet.ReadModeAsync),
)
if err != nil {
return err
return fmt.Errorf("failed to open file %s: %w", e.DataFile().FilePath(), err)
}

// Get a reader from the file bytes
Expand Down
2 changes: 1 addition & 1 deletion store.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (b *DefaultObjstoreBucket) openBlockFile(ctx context.Context, blockName str
parquet.FileReadMode(parquet.ReadModeAsync),
)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to open block: %s :%v", blockName, err)
}

return file, nil
Expand Down

0 comments on commit defafee

Please sign in to comment.