Skip to content

Commit 73cfddf

Browse files
committed
String view is now the default type for strings
1 parent 380a2ac commit 73cfddf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/datafusion/expr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ def literal(value: Any) -> Expr:
374374
375375
``value`` must be a valid PyArrow scalar value or easily castable to one.
376376
"""
377+
if isinstance(value, str):
378+
value = pa.scalar(value, type=pa.string_view())
377379
if not isinstance(value, pa.Scalar):
378380
value = pa.scalar(value)
379381
return Expr(expr_internal.Expr.literal(value))
@@ -419,7 +421,7 @@ def fill_null(self, value: Any | Expr | None = None) -> Expr:
419421
_to_pyarrow_types = {
420422
float: pa.float64(),
421423
int: pa.int64(),
422-
str: pa.string(),
424+
str: pa.string_view(),
423425
bool: pa.bool_(),
424426
}
425427

0 commit comments

Comments
 (0)