Skip to content

Conversation

@cramosme
Copy link

@cramosme cramosme commented Apr 13, 2025

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?

@github-actions
Copy link

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?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@cramosme cramosme changed the title [C++] FixedSizeListBuilder should have UnsafeAppend methods #45723 GH-45723: [C++] FixedSizeListBuilder should have UnsafeAppend methods May 30, 2025
@github-actions
Copy link

⚠️ GitHub issue #45723 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@pitrou pitrou left a 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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can you please add docstrings for these new methods?
  2. 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_);
Copy link
Member

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();
Copy link
Member

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.

@cramosme cramosme closed this Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants