timsaucer commented on code in PR #962:
URL: https://github.com/apache/datafusion-python/pull/962#discussion_r1877966060
##########
python/datafusion/__init__.py:
##########
@@ -107,6 +107,11 @@ def literal(value):
return Expr.literal(value)
+def utf8_literal(value):
+ """Create a UTF8 literal expression."""
+ return Expr.utf8_literal(value)
+
+
Review Comment:
This sounds like a useful function to have in. I think from an end user
perspective, calling it `utf8_literal` will be less ergonomic than
`string_literal`. My reasoning is that most python users will be used to `str`
in Python and `pa.string()` for PyArrow.
I would even consider adding or changing this to `str_lit` for brevity.
Maybe both?
##########
python/datafusion/functions.py:
##########
@@ -1108,6 +1109,11 @@ def arrow_typeof(arg: Expr) -> Expr:
return Expr(f.arrow_typeof(arg.expr))
+def arrow_cast(expr: Expr, data_type: Expr) -> Expr:
+ """Casts an expression to a specified data type."""
+ return Expr(f.arrow_cast(expr.expr, data_type.expr))
+
+
Review Comment:
I haven't delved into the `datafusion` core library to see - how is this
different than `Expr.cast`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]