Skip to content

Commit

Permalink
docs: fix pyarrow batches docstring
Browse files Browse the repository at this point in the history
we return RecordBatchReader, not an iterable
  • Loading branch information
gforsyth authored and cpcloud committed Nov 29, 2022
1 parent 08046aa commit dba9594
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
7 changes: 3 additions & 4 deletions ibis/backends/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ def to_pyarrow_batches(
chunk_size: int = 1_000_000,
**kwargs: Any,
) -> pa.RecordBatchReader:
"""Execute expression and return results in an iterator of pyarrow
record batches.
"""Execute expression and return a RecordBatchReader.
This method is eager and will execute the associated expression
immediately.
Expand All @@ -319,8 +318,8 @@ def to_pyarrow_batches(
Returns
-------
record_batches
An iterator of pyarrow record batches.
results
RecordBatchReader
"""
raise NotImplementedError

Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/base/sql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def to_pyarrow_batches(
Returns
-------
record_batches
An iterator of pyarrow record batches.
results
RecordBatchReader
"""
pa = self._import_pyarrow()

Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/duckdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def to_pyarrow_batches(
params: Mapping[ir.Scalar, Any] | None = None,
limit: int | str | None = None,
chunk_size: int = 1_000_000,
) -> Iterator[pa.RecordBatch]:
) -> IbisRecordBatchReader:
_ = self._import_pyarrow()
query_ast = self.compiler.to_ast_ensure_limit(expr, limit, params=params)
sql = query_ast.compile()
Expand Down
11 changes: 5 additions & 6 deletions ibis/expr/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
import webbrowser
from typing import TYPE_CHECKING, Any, Iterable, Mapping
from typing import TYPE_CHECKING, Any, Mapping

import toolz
from public import public
Expand Down Expand Up @@ -311,9 +311,8 @@ def to_pyarrow_batches(
params: Mapping[ir.Value, Any] | None = None,
chunk_size: int = 1_000_000,
**kwargs: Any,
) -> Iterable[pa.RecordBatch]:
"""Execute expression and return results in an iterator of pyarrow
record batches.
) -> pa.RecordBatchReader:
"""Execute expression and return a RecordBatchReader.
This method is eager and will execute the associated expression
immediately.
Expand All @@ -330,8 +329,8 @@ def to_pyarrow_batches(
Returns
-------
record_batches
An iterator of pyarrow record batches.
results
RecordBatchReader
"""
return self._find_backend().to_pyarrow_batches(
self,
Expand Down

0 comments on commit dba9594

Please sign in to comment.