Skip to content

Commit cdf32cd

Browse files
committed
fix: enhance utf8_literal function to handle non-string values
1 parent 3b83a96 commit cdf32cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/datafusion/expr.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,10 @@ def literal(value: Any) -> Expr:
383383
@staticmethod
384384
def utf8_literal(value: str) -> Expr:
385385
"""Creates a new expression representing a UTF8 literal value."""
386-
value = pa.scalar(value, type=pa.string())
387-
return Expr(expr_internal.Expr.literal(value))
386+
if isinstance(value, str):
387+
value = pa.scalar(value, type=pa.string())
388+
return Expr(expr_internal.Expr.literal(value))
389+
return literal(value)
388390

389391
@staticmethod
390392
def column(value: str) -> Expr:

0 commit comments

Comments
 (0)