Skip to content

Conversation

@tokoko
Copy link
Contributor

@tokoko tokoko commented Oct 20, 2024

Which issue does this PR close?

Closes #12862

Are there any user-facing changes?

union with a single input no longer works (technically a breaking change)

@github-actions github-actions bot added the substrait Changes to the substrait crate label Oct 20, 2024
Copy link
Contributor

@vbarua vbarua left a comment

Choose a reason for hiding this comment

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

This matches what the Substrait spec requires. One thing we should mentioned is that this is technically a breaking change, as UNION or UNION ALL plans with only a single-input will stop working.

"PrimaryAll Minus relation requires at least two inputs"
)
Ok(set_op) => {
if set.inputs.len() >= 2 {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: Would it be cleaner to pull this out to the top like

if set.inputs.len() <= 1 {
  substrait_err!("Set operation requires at least two inputs")
}

so it's clearer what the invariant is (by having the check right next to the error) and avoid indenting the match block?

(I'm not sure if this is idiomatic Rust)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't really judge if it's idiomatic or not with my whole 2 weeks of rust experience 😆 but makes sense. I'll flip it.

@alamb alamb added the api change Changes the API exposed to users of the crate label Oct 21, 2024
@alamb
Copy link
Contributor

alamb commented Oct 21, 2024

This matches what the Substrait spec requires. One thing we should mentioned is that this is technically a breaking change, as UNION or UNION ALL plans with only a single-input will stop working.

Marked it as API change

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.

Thanks @tokoko and @vbarua

@alamb alamb merged commit 91d2886 into apache:main Oct 22, 2024
24 checks passed
@tokoko tokoko deleted the single-union branch October 22, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Substrait: union with a single input shouldn't be accepted

3 participants