Skip to content

Commit

Permalink
String view is now the default type for strings
Browse files Browse the repository at this point in the history
  • Loading branch information
timsaucer committed Nov 9, 2024
1 parent 380a2ac commit 73cfddf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/datafusion/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ def literal(value: Any) -> Expr:
``value`` must be a valid PyArrow scalar value or easily castable to one.
"""
if isinstance(value, str):
value = pa.scalar(value, type=pa.string_view())
if not isinstance(value, pa.Scalar):
value = pa.scalar(value)
return Expr(expr_internal.Expr.literal(value))
Expand Down Expand Up @@ -419,7 +421,7 @@ def fill_null(self, value: Any | Expr | None = None) -> Expr:
_to_pyarrow_types = {
float: pa.float64(),
int: pa.int64(),
str: pa.string(),
str: pa.string_view(),
bool: pa.bool_(),
}

Expand Down

0 comments on commit 73cfddf

Please sign in to comment.