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

Make Substrait Schema Structs always non-nullable #15011

Merged

Conversation

amoeba
Copy link
Member

@amoeba amoeba commented Mar 5, 2025

Which issue does this PR close?

Rationale for this change

#12244 reported a larger problem with plan generation which was mostly but not completely fixed by #12245. As noted in #12244, invalid plans could be still be generated.

What changes are included in this PR?

Structs for Schemas are set to always non-nullable.

Are these changes tested?

Yes. I ran the substrait-validator CLI over a plan generated from datafusion built with this patch.

Are there any user-facing changes?

No.

@github-actions github-actions bot added the substrait Changes to the substrait crate label Mar 5, 2025
@amoeba amoeba changed the title Make Substrait Schemas always non-nullable Make Substrait Schema Structs always non-nullable Mar 5, 2025
Copy link
Contributor

@Blizzara Blizzara left a comment

Choose a reason for hiding this comment

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

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.

Thank you @amoeba

I trust @Blizzara 's review on this one as I didn't review the history

cc @vbarua in case you have additional thoughts

I am not sure if there is any way to test / validate this fix (in the sense that if someone broke it by accident now no test would fail)

@amoeba
Copy link
Member Author

amoeba commented Mar 5, 2025

I am not sure if there is any way to test / validate this fix (in the sense that if someone broke it by accident now no test would fail)

I didn't see a good place in the existing test suite to add a test for this, would you see any downside to taking the substrait-validator crate on as a dev-dependency and adding a small suite to ensure a set of basic plans are always valid?

@alamb
Copy link
Contributor

alamb commented Mar 5, 2025

I didn't see a good place in the existing test suite to add a test for this, would you see any downside to taking the substrait-validator crate on as a dev-dependency and adding a small suite to ensure a set of basic plans are always valid?

That seems like a (very) good idea to me as producing valid substrait seems quite useful

Perhaps we can do it as a follow on PR?

@alamb alamb merged commit 9a4c9d5 into apache:main Mar 5, 2025
27 checks passed
@alamb
Copy link
Contributor

alamb commented Mar 5, 2025

Thank you @amoeba

@vbarua
Copy link
Contributor

vbarua commented Mar 6, 2025

Thanks for chasing this up here and in the core Substrait spec @amoeba 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
substrait Changes to the substrait crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Substrait plan read relation baseSchema does not include the struct with type information
4 participants