-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Added raw_values to SliceMut #174
Conversation
Pull Request Test Coverage Report for Build 8e5bd2648a9b25b8eaaa768f6936a8f9ebfb3947-PR-174
💛 - Coveralls |
F**k. I thought I merged this slightly different branch weeks ago: f8b2b23 ! Sorry, I'll take care of it this evening. Seems also like I duplicated some work here. |
I even added it to the Changelog of 0.35.1. I clearly do not get enough sleep lately 😓 |
Wait, seems I did merge it |
Feature is already deployed: https://docs.rs/odbc-api/latest/odbc_api/buffers/struct.NullableSlice.html#method.raw_values or do I miss something? |
Ahh, now I get it, its about mutable slices! |
That method must be unsafe though, because not every driver (looking at you MariaDB) does checks wether the indicator value is larger than the column. It's easy then to create access to invalid memory in safe code, by specifying an indicator too large. See: odbc-api/odbc-api/tests/integration.rs Line 2306 in e8ab681
There is a soundness issue I still need to close around ColumnBuffer for these drivers. Issue is different invariants for Buffers regarding Reading and Writing. |
uhm that is a good point. Maybe a function that consumes an iterator of bools and populates the indicators accordingly? This would avoid overflowing the buffer's max len? |
Possible, but didn't you want to access it in parallel.
I may walk back on that. Come to think of it, this is only invoked on fixed sized (POD) types. The issue I raised would only apply to text / binary columns. According to the standard ODBC should only care about wether this is NULL data or not. Some drivers might still use indicators to calculate the offset, but would be willing to deem this method safe until proven otherwise. |
I left the binary out until we check whether we need to expose that at all (based on benches). |
It still fails with the docs |
78d0922
to
5ab661c
Compare
Hm, come to think of it, only the binary layout of the value buffer is identical. I'd prefer to go with your idea of taking an iterator over booleans for the indicator. Would this allow you to write code just as fast? |
would a patch with this be possible? It would allow me to release arrow2 with the ODBC to crates.io ^^ |
sure, just wondering about the interface to the indicator |
would exposing only the raw values, together with the possibility to take an iterator over bools allow for the same performance gains. |
I'll release now, with the current interface, and break it later in case your answer will turn out to be 'yes'. |
you mean for the binColumn? |
I meant actually for |
Version |
No description provided.