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

[BUG] segmented_reduce does not accept empty offsets #17433

Closed
ttnghia opened this issue Nov 24, 2024 · 3 comments · Fixed by #17437
Closed

[BUG] segmented_reduce does not accept empty offsets #17433

ttnghia opened this issue Nov 24, 2024 · 3 comments · Fixed by #17437
Labels
bug Something isn't working

Comments

@ttnghia
Copy link
Contributor

ttnghia commented Nov 24, 2024

When the input is all empty, i.e., we have empty input values and empty offsets, segmented_reduce throws an exception:

C++ exception with description "CUDF failure at: ../../src/reductions/segmented/reductions.cpp:163: `offsets` should have at least 1 element."

This is wrong, as it should be able to handle the case of empty input.

@ttnghia ttnghia added the bug Something isn't working label Nov 24, 2024
@davidwendt
Copy link
Contributor

This appears to be working as designed. There are a couple of tests for the case where in the input is empty. Here is one:

TEST_F(SegmentedReductionTestUntyped, EmptyInputWithOffsets)

I think it reasonable to return an exception when no offsets are provided.

@ttnghia
Copy link
Contributor Author

ttnghia commented Nov 25, 2024

I think that test had to generate offsets because of this bug, not because the API was designed so. If a column is empty (data), having empty offsets should be the correct behavior. We implemented make_empty_lists_column (and also empty strings column) by that design.

@davidwendt
Copy link
Contributor

davidwendt commented Nov 25, 2024

Nope, this is not a bug but was intentional behavior as per a request from Spark found here: #10556 (comment)

However, I think it reasonable to return an empty column if both the input and offsets are empty.
I can create a PR for that shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants