Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array overloads inconsistent plus should have DataTypes in type parameter #86

Closed
deanm0000 opened this issue Sep 12, 2024 · 0 comments · Fixed by #89
Closed

array overloads inconsistent plus should have DataTypes in type parameter #86

deanm0000 opened this issue Sep 12, 2024 · 0 comments · Fixed by #89

Comments

@deanm0000
Copy link
Contributor

There's inconsistency in the return signature between the cases where it can infer the type from values from when it can't but the type is specified. Compare

def array(
values: NullableIterable[str],
type: None = None,
mask: Mask | None = None,
size: int | None = None,
from_pandas: bool | None = None,
safe: bool = True,
memory_pool: MemoryPool | None = None,
) -> StringArray: ...

to

def array(
values: Iterable | SupportArrowArray | SupportArrowDeviceArray,
type: Literal["string", "str", "utf8"],
mask: Mask | None = None,
size: int | None = None,
from_pandas: bool | None = None,
safe: bool = True,
memory_pool: MemoryPool | None = None,
) -> Array[scalar.StringScalar]: ...

It would seem the cases where the type is entered should also return StringArray (of course same point for the rest of the typed arrays) but I don't know if I'm missing something about what Array[scalar.StringScalar] is meant to convey.

Additionally, the cases where the type is specified should include the DataType, for example

    type: Literal["string", "str", "utf8"] | StringType,
@zen-xu zen-xu linked a pull request Sep 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant