Skip to content

Commit de9f3c2

Browse files
sumedhsakdeoclaude
andcommitted
Fix long line and B008 error in ArrowScan
- Break long line in _iter_batches_arrival call for better readability - Fix B008 error by moving TaskOrder() call from function default to inside function - Sort imports alphabetically 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2d4a67a commit de9f3c2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pyiceberg/io/pyarrow.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
visit,
145145
visit_with_partner,
146146
)
147-
from pyiceberg.table import DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE, ScanOrder, TaskOrder, ArrivalOrder, TableProperties
147+
from pyiceberg.table import DOWNCAST_NS_TIMESTAMP_TO_US_ON_WRITE, ArrivalOrder, ScanOrder, TableProperties, TaskOrder
148148
from pyiceberg.table.locations import load_location_provider
149149
from pyiceberg.table.metadata import TableMetadata
150150
from pyiceberg.table.name_mapping import NameMapping, apply_name_mapping
@@ -1838,7 +1838,7 @@ def to_record_batches(
18381838
self,
18391839
tasks: Iterable[FileScanTask],
18401840
batch_size: int | None = None,
1841-
order: ScanOrder = TaskOrder(),
1841+
order: ScanOrder | None = None,
18421842
) -> Iterator[pa.RecordBatch]:
18431843
"""Scan the Iceberg table and return an Iterator[pa.RecordBatch].
18441844
@@ -1868,6 +1868,9 @@ def to_record_batches(
18681868
ValueError: When a field type in the file cannot be projected to the schema type,
18691869
or when an invalid order value is provided, or when concurrent_streams < 1.
18701870
"""
1871+
if order is None:
1872+
order = TaskOrder()
1873+
18711874
if not isinstance(order, ScanOrder):
18721875
raise ValueError(f"Invalid order: {order!r}. Must be a ScanOrder instance (TaskOrder() or ArrivalOrder()).")
18731876

@@ -1876,7 +1879,11 @@ def to_record_batches(
18761879
if isinstance(order, ArrivalOrder):
18771880
if order.concurrent_streams < 1:
18781881
raise ValueError(f"concurrent_streams must be >= 1, got {order.concurrent_streams}")
1879-
return self._apply_limit(self._iter_batches_arrival(task_list, deletes_per_file, batch_size, order.concurrent_streams, order.max_buffered_batches))
1882+
return self._apply_limit(
1883+
self._iter_batches_arrival(
1884+
task_list, deletes_per_file, batch_size, order.concurrent_streams, order.max_buffered_batches
1885+
)
1886+
)
18801887

18811888
return self._apply_limit(self._iter_batches_materialized(task_list, deletes_per_file, batch_size))
18821889

0 commit comments

Comments
 (0)