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

Fix nested nullability when randomly generating arrays #5713

Merged
merged 8 commits into from
May 11, 2024

Conversation

alexwilcoxson-rel
Copy link
Contributor

@alexwilcoxson-rel alexwilcoxson-rel commented May 3, 2024

Which issue does this PR close?

Closes #5712

Rationale for this change

We would like to create random arrays for testing and leveraging data_gen module but it current breaks with our schema of:

List not-nullable
    Struct nullable
        field_a nullable
        field_b nullable

More details are provided on issue #5712

What changes are included in this PR?

The changes are isolated to the create_random_array and create_random_list_array functions. Previously the code would assume if the field is not null, set null_density to zero. However that zero is then passed down into nested fields' create_random_array calls, thus resulting in no nulls in those arrays. This PR preserves the original null_density to pass into nested create_random_array calls.

Are there any user-facing changes?

There is a behavior change with array generation with schemas that have nested nullable fields under non-nullable fields.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Look good (and well tested to me). Thank you @alexwilcoxson-rel

@alamb
Copy link
Contributor

alamb commented May 11, 2024

I believe the docs CI test was fixed on main and the integration test failure is due to #5719

@alamb alamb merged commit 158e54d into apache:master May 11, 2024
20 of 22 checks passed
@alexwilcoxson-rel alexwilcoxson-rel deleted the rand-null-density branch August 30, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested nullable fields do not get treated as nullable in data_gen
2 participants