Skip to content

Commit 57d17f4

Browse files
committed
if dtype=None, use library default
1 parent 2622fbc commit 57d17f4

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

narwhals/_arrow/namespace.py

-3
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,6 @@ def _lit_arrow_series(_: ArrowDataFrame) -> ArrowSeries:
181181
)
182182
if dtype:
183183
return arrow_series.cast(dtype)
184-
elif isinstance(value, str) and dtype is None:
185-
# Cast to nw.String() to ensure we default to large-string.
186-
return arrow_series.cast(import_dtypes_module(self._version).String())
187184
return arrow_series
188185

189186
return ArrowExpr(

tests/expr_and_series/lit_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,6 @@ def test_date_lit(constructor: Constructor, request: pytest.FixtureRequest) -> N
135135
def test_pyarrow_lit_string() -> None:
136136
df = nw.from_native(pa.table({"a": [1, 2, 3]}))
137137
result = df.select(nw.lit("foo")).to_native().schema.field("literal")
138-
assert pa.types.is_large_string(result.type)
138+
assert pa.types.is_string(result.type)
139139
result = df.select(nw.lit("foo", dtype=nw.String)).to_native().schema.field("literal")
140140
assert pa.types.is_large_string(result.type)

0 commit comments

Comments
 (0)