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-10566: [C++] Allow validating ArrayData directly #8652
Conversation
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.
Thanks for doing this! A few minor notes
} | ||
// Check offsets are in bounds | ||
const int32_t* offsets = data.GetValues<int32_t>(2); | ||
for (int64_t i = 0; i < data.length; ++i) { | ||
const int32_t code = type_codes[i]; | ||
const int32_t offset = offsets[i]; | ||
if (offset < 0) { |
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.
We should probably also validate that the offsets are strictly increasing
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.
No, that's not required for unions. cc @wesm
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.
https://arrow.apache.org/docs/format/Columnar.html#dense-union
"The respective offsets for each child value array must be in order / increasing."
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.
Doesn't need to happen in this PR: https://issues.apache.org/jira/browse/ARROW-10580
Having to construct an Array from ArrayData entails various assertions which may fail. It is therefore safer to be able to validate the data *before*.
204e000
to
3952519
Compare
Having to construct an Array from ArrayData entails various assertions which may fail. It is therefore safer to be able to validate the data *before*. Closes apache#8652 from pitrou/ARROW-10566-validate-data Authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
Having to construct an Array from ArrayData entails various assertions which may fail. It is therefore safer to be able to validate the data *before*. Closes apache#8652 from pitrou/ARROW-10566-validate-data Authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
Having to construct an Array from ArrayData entails various assertions which may fail.
It is therefore safer to be able to validate the data before.