-
Notifications
You must be signed in to change notification settings - Fork 36
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
refactor!: rewrite <DataFrame>$get_columns()
#991
Conversation
let cols = self.0.get_columns().to_vec(); | ||
let vec = unsafe { std::mem::transmute::<Vec<pl::Series>, Vec<RPolarsSeries>>(cols) }; | ||
List::from_values(vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change, the original was readable and didn't have any unsafe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation is copied from Python.
What is the problem with unsafe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation is copied from Python.
I didn't see it in get_columns()
but indeed to_pyseries()
has that. So I'm fine with that
What is the problem with unsafe?
I don't have a great knowledge of Rust, so I'd rather avoid unsafe
since I have no idea in which context it's fine and in which it's not. Maybe there's no problem in this case, but I don't know that in advance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can completely eliminate unsafe
in terms of accessing the C ABI of Python or R.
(As evidenced by the fact that we sometimes crash R sessions.)
No description provided.