Skip to content
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-9489: [C++] Add fill_null kernel implementation for (array[string], scalar[string]) #8628

Closed
wants to merge 11 commits into from

Conversation

maartenbreddels
Copy link
Contributor

@maartenbreddels maartenbreddels commented Nov 10, 2020

No description provided.

KERNEL_RETURN_IF_ERROR(
ctx, builder.ReserveData(input.buffers[2]->size() +
fill_value.length() * input.GetNullCount()));
KERNEL_RETURN_IF_ERROR(ctx, builder.Resize(input.length + 1));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I accidentally forgot the +1 here, and everything worked. Does CI include valgrind, and should it pick this up?

Copy link
Member

Choose a reason for hiding this comment

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

The +1 should not be necessary. This is the number of values appended, not the number of offsets.

@github-actions
Copy link

@maartenbreddels
Copy link
Contributor Author

Looking at the implementation of VisitArrayDataInline, which is quite similar to what is being done in FillNullFunctor<Type, enable_if_t<is_number_type<Type>::value>>, I don't see much room for improvement.

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.

Just a couple comments. Thank you for this PR!

// null count 0 unless we explicitly propagate it below.
DCHECK(output->buffers[0] == nullptr);

if (input.MayHaveNulls() && fill_value_scalar.is_valid) {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of calling MayHaveNulls, just compute the null count and check it here.

cpp/src/arrow/compute/kernels/scalar_fill_null.cc Outdated Show resolved Hide resolved
docs/source/cpp/compute.rst Show resolved Hide resolved
python/pyarrow/tests/test_compute.py Show resolved Hide resolved
@maartenbreddels
Copy link
Contributor Author

@pitrou i think this is ready to go/review.

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.

+1, will merge. Thank you @maartenbreddels !

@pitrou pitrou closed this in 7c509a6 Nov 16, 2020
GeorgeAp pushed a commit to sirensolutions/arrow that referenced this pull request Jun 7, 2021
…ng], scalar[string])

Closes apache#8628 from maartenbreddels/ARROW-9489

Lead-authored-by: Maarten A. Breddels <maartenbreddels@gmail.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants