Commit 02c016f
[SPARK-54762][PYTHON] Fix
### What changes were proposed in this pull request?
Fix the overload signature of `_create_converter`. The default value should be `False`.
Also fixed the overload signature of `convert`. The return value should be List[Row | tuple] if `return_as_tuples` is passed - because an explicit `True` can be passed.
### Why are the changes needed?
I would guess that the original author tried to express that "if `none_on_identity` is `True`, then it could return `None`", but this is the wrong expression. You can't express such a concept in the current Python typing system. (You can use `Literal` but that requires the users to pass the literal `True` or `False`, not a variable).
The current signature means the default value of `none_on_identity` is `True` which is incorrect. The default value of a overload signature is not used by the type checker, but it will be shown in IDE and this is misleading.
Same thing for `convert`.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
No code is changed.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes apache#53467 from gaogaotiantian/conversion-overload.
Authored-by: Tian Gao <[email protected]>
Signed-off-by: Takuya Ueshin <[email protected]>_create_converter and covert overload signature1 parent a26c209 commit 02c016f
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
814 | | - | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
815 | 817 | | |
816 | 818 | | |
817 | 819 | | |
| |||
0 commit comments