timsaucer commented on code in PR #1786:
URL:
https://github.com/apache/datafusion-python/pull/1786#discussion_r4221314035
##########
python/datafusion/functions/spark.py:
##########
@@ -56,14 +56,14 @@ def _filter_raw(filter: Expr | None) -> Any:
return filter.expr if filter is not None else None
-def _coerce_i32(value: Expr | int | None) -> Expr | None:
- """Coerce a native ``int`` to an int32 literal, passing ``Expr``/``None``
through.
+def _coerce_i32(value: Expr | int) -> Expr:
+ """Coerce a native ``int`` to an int32 literal, passing ``Expr`` through.
Several Spark datetime and interval builders require 32-bit integer
inputs, so a bare ``int`` must become an int32 literal rather than the
int64 default that :meth:`Expr.literal` would produce.
"""
Review Comment:
All call sites handle `None` before calling (`... if x is not None else
_ZERO_I32`) or take non-optional parameters. On main, a `None` here would have
failed on `.expr`.
--
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]