Skip to content

Commit

Permalink
feat: Adds _Reader._read_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned committed Nov 9, 2024
1 parent c572180 commit 9ab9463
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion altair/datasets/_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def query(
"""
source = self._metadata
fn = self.scanner_from(source)
frame = nw.from_native(fn(source), pass_through=False)
frame = nw.from_native(fn(source))
result = frame.filter(_filter_reduce(predicates, constraints))
df: nw.DataFrame[Any] = (
result.collect() if isinstance(result, nw.LazyFrame) else result
Expand All @@ -178,6 +178,19 @@ def query(
msg = f"Found no results for:\n{terms}"
raise NotImplementedError(msg)

def _read_metadata(self) -> IntoDataFrameT:
"""
Return the full contents of ``metadata.parquet``.
Effectively an eager read, no filters.
"""
fn = self.scanner_from(self._metadata)
frame = nw.from_native(fn(self._metadata))
df: nw.DataFrame[Any] = (
frame.collect() if isinstance(frame, nw.LazyFrame) else frame
)
return df.to_native()

@property
def _cache(self) -> Path | None: # type: ignore[return]
"""
Expand Down

0 comments on commit 9ab9463

Please sign in to comment.