timsaucer commented on code in PR #1786:
URL:
https://github.com/apache/datafusion-python/pull/1786#discussion_r4208914858
##########
python/datafusion/dataframe.py:
##########
@@ -1158,8 +1160,8 @@ def join(
if left_on is not None or right_on is not None:
error_msg = "`left_on` or `right_on` should not provided with
`on`"
raise ValueError(error_msg)
- left_on = on
- right_on = on
+ # The legacy ``(left, right)`` tuple form was consumed above.
+ left_on = right_on = cast("str | Sequence[str]", on)
Review Comment:
This is a no-op at runtime but will make it so type checkers recognize that
we've already verified the type.
##########
python/datafusion/expr.py:
##########
@@ -410,8 +411,18 @@ def _to_raw_expr(value: Expr | str) -> expr_internal.Expr:
raise TypeError(error)
+@overload
+def expr_list_to_raw_expr_list(expr_list: None) -> None: ...
+
+
+@overload
+def expr_list_to_raw_expr_list(
+ expr_list: Sequence[Expr | str] | Expr | str,
+) -> list[expr_internal.Expr]: ...
Review Comment:
These overloads make it so type checkers understand that if a `None` if fed
in you get a `None` out, otherwise you get a valid list of `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]