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

ARROW-9451: [Python] Refuse implicit cast of str to unsigned integer #9912

Closed
wants to merge 1 commit into from

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Apr 6, 2021

Ensure that pa.array(['5'], type='uint32') raises an exception.

Ensure that `pa.array(['5'], type='uint32')` raises an exception.
@jorisvandenbossche
Copy link
Member

It's good to make this consistent for signed vs unsigned integer types.
But, if pa.array(['5']).cast("int64") works, I would maybe also expect pa.array(['5'], type="int64") to work (eg in numpy both work). Now, that would be a much bigger change I suppose, I am certainly fine with making it more strict.

@pitrou
Copy link
Member Author

pitrou commented Apr 6, 2021

I'm not fond of lax conversions. Much better to have people explicitly cast if they want to, IMHO.

@jorisvandenbossche
Copy link
Member

Sounds good, as long as we are consistent.

@github-actions
Copy link

github-actions bot commented Apr 6, 2021

@pitrou pitrou closed this in d95c72f Apr 7, 2021
@pitrou pitrou deleted the ARROW-9451-implicit-str-to-int branch April 7, 2021 12:04
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
Ensure that `pa.array(['5'], type='uint32')` raises an exception.

Closes apache#9912 from pitrou/ARROW-9451-implicit-str-to-int

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
michalursa pushed a commit to michalursa/arrow that referenced this pull request Jun 10, 2021
Ensure that `pa.array(['5'], type='uint32')` raises an exception.

Closes apache#9912 from pitrou/ARROW-9451-implicit-str-to-int

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
michalursa pushed a commit to michalursa/arrow that referenced this pull request Jun 13, 2021
Ensure that `pa.array(['5'], type='uint32')` raises an exception.

Closes apache#9912 from pitrou/ARROW-9451-implicit-str-to-int

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants