Skip to content

Commit

Permalink
fix(DRAFT): hotfix pyarrow read
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned committed Nov 10, 2024
1 parent bb7bc17 commit ebc1bfa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion altair/datasets/_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def scan_fn(self, source: StrPath, /) -> Callable[..., IntoFrameT]:
suffix = validate_suffix(source, is_ext_scan)
return self._scan_fn[suffix]

def _response_hook(self, f):
# HACK: pyarrow wants the file obj
return f.read()

def dataset(
self,
name: DatasetName | LiteralString,
Expand Down Expand Up @@ -133,7 +137,7 @@ def dataset(
return fn(fp, **kwds)
else:
with self._opener.open(url) as f:
return fn(f.read(), **kwds)
return fn(self._response_hook(f), **kwds)

def url(
self,
Expand Down Expand Up @@ -329,6 +333,9 @@ def __init__(self, name: _PyArrow, /) -> None:
}
self._scan_fn = {".parquet": pa_read_parquet}

def _response_hook(self, f):
return f


def _filter_reduce(predicates: tuple[Any, ...], constraints: Metadata, /) -> nw.Expr:
"""
Expand Down

0 comments on commit ebc1bfa

Please sign in to comment.