Skip to content

Commit

Permalink
refactor(pyarrow-format): avoid constructing unnecessary array to pro…
Browse files Browse the repository at this point in the history
…duce a scalar
  • Loading branch information
cpcloud committed Sep 24, 2024
1 parent c8c37dd commit 92e6657
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions ibis/formats/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ def convert_scalar(cls, scalar: pa.Scalar, dtype: dt.DataType) -> pa.Scalar:
except pa.ArrowNotImplementedError:
# pyarrow doesn't support some scalar casts that are supported
# when using arrays or tables
return pa.array([scalar.as_py()], type=scalar_type).cast(desired_type)[
0
]
return pa.scalar(scalar.as_py(), type=scalar_type).cast(desired_type)

Check warning on line 307 in ibis/formats/pyarrow.py

View check run for this annotation

Codecov / codecov/patch

ibis/formats/pyarrow.py#L307

Added line #L307 was not covered by tests
else:
return scalar

Expand Down

0 comments on commit 92e6657

Please sign in to comment.