Skip to content

feat(substrait): add a hook for consuming relation inputs - #26679

Closed
alexanderbianchi wants to merge 1 commit into
apache:mainfrom
alexanderbianchi:codex/substrait-input-hook
Closed

alexanderbianchi wants to merge 1 commit into
apache:mainfrom
alexanderbianchi:codex/substrait-input-hook

Conversation

@alexanderbianchi

@alexanderbianchi alexanderbianchi commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

No linked issue. This extracts the extension point from a larger concurrent-consumer change; parallel default-consumer behavior is isolated in stacked draft #26680.

Rationale for this change

Custom Substrait consumers cannot overlap independent JOIN/UNION input consumption while reusing upstream operator assembly. Those helpers await each child directly. Downstream consumers currently need to override the operators and wrap already-consumed children just to control scheduling.

What changes are included in this PR?

Add SubstraitConsumer::consume_rel_inputs(&[&Rel]) -> Result<Vec<LogicalPlan>> and call it from JOIN and UNION assembly. The default consumes inputs sequentially and stops on the first consumption error. Overrides must return one plan per input in input order; assembly checks the count.

This PR adds no branch cloning, concurrency, caching, semaphore, or dependency. JOIN/UNION assembly still handles predicates, qualification, and distinctness. Invalid JOINs with missing children return an error instead of panicking.

What is the testing strategy for this PR?

Tests exercise the public consumer trait: sequential default consumption with a gated first input, error short-circuiting, custom-hook dispatch for JOIN/UNION ALL/UNION DISTINCT, input order, and rejection of incorrect result counts. Existing Substrait integration tests cover operator semantics.

Validation passed on base 6bb92bb3f:

  • cargo fmt --all.
  • Workspace cargo clippy --profile ci --all-targets --all-features -- -D warnings.
  • The repository-prescribed extended workspace test command: 12,896 Rust tests and 540 SQL logic test files passed, including the Substrait tests.
  • The focused Substrait run also passed 3 doctests (and 70 unit / 228 integration tests, with 6 integration tests ignored).

The optional standalone lint suite could not start because system Python lacks PyYAML; formatting and Clippy were run directly.

Are there any user-facing changes?

Adds a provided trait method, so existing consumer implementations remain source-compatible and keep sequential input consumption. Custom consumers can override scheduling without replacing operator assembly.

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.

1 participant