Skip to content

Commit

Permalink
feat: raise error in from_parquet when df is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ireneisdoomed committed Nov 20, 2023
1 parent 1351728 commit a1c41e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/otg/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,14 @@ def from_parquet(
Returns:
Self: Dataset with the parquet file contents
Raises:
ValueError: Parquet file is empty
"""
schema = cls.get_schema()
df = session.read_parquet(path=path, schema=schema, **kwargs)
if df.isEmpty():
raise ValueError(f"Parquet file is empty: {path}")
return cls(_df=df, _schema=schema)

def validate_schema(self: Dataset) -> None:
Expand Down

0 comments on commit a1c41e6

Please sign in to comment.