-
Notifications
You must be signed in to change notification settings - Fork 3.9k
GH-45723: [C++] FixedSizeListBuilder should have UnsafeAppend methods #46126
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
Conversation
Edited scalar_nested.cc and fixed_width_test_util.cc. Ran ctest after and all test still pass
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
|
|
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 @cramosme for submitting this PR. Please find some comments below. Also, can you add unit tests?
| /// using the child array builder. | ||
| Status Append(); | ||
|
|
||
| void UnsafeAppend(); |
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.
- Can you please add docstrings for these new methods?
- Ideally, the definition of the methods should be inline here, so that they can be inlined in the caller.
|
|
||
| void FixedSizeListBuilder::UnsafeAppendNull() { | ||
| UnsafeAppendToBitmap(false); | ||
| (void) value_builder_->AppendNulls(list_size_); |
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 don't want to ignore error returns, so instead we should call a hypothetical UnsafeAppendNulls(list_size_).
If such a method doesn't exist, it should be added.
| auto* fsl_builder = checked_cast<FixedSizeListBuilder*>(builder); | ||
| assert(list_size == checked_cast<FixedSizeListType&>(*type).list_size()); | ||
| RETURN_NOT_OK(fsl_builder->Append()); | ||
| fsl_builder->UnsafeAppend(); |
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 should change this one. This is a testing utility, so we value robustness over performance.
Rationale for this change
What changes are included in this PR? I added the three UnsafeAppend methods for FixedSizeListBuilder and replaced
instances in three files to call UnsafeAppend instead of regular append. Files changed were: scalar_nested.cc, fixed_width_test_util.cc, and scalar_string_ascii.cc, along with the header and cc file where functions were declared/defined.
Are these changes tested? Upon each change, I recompiled and rebuilt the program and tested with ctest. Through my testing, everything seemed to be working as usual.
Are there any user-facing changes?