Skip to content

feat: Add Protobuf support for Explain node#21994

Open
danielhumanmod wants to merge 2 commits intoapache:mainfrom
danielhumanmod:explain-proto
Open

feat: Add Protobuf support for Explain node#21994
danielhumanmod wants to merge 2 commits intoapache:mainfrom
danielhumanmod:explain-proto

Conversation

@danielhumanmod
Copy link
Copy Markdown
Contributor

@danielhumanmod danielhumanmod commented May 3, 2026

Which issue does this PR close?

  • Closes #.

Rationale for this change

EXPLAIN FORMAT TREE is supported in logical plans, but protobuf serialization did not preserve the explain format.

In Datafusion Ballista, we need the format field to generate corresponding distributed plan.
apache/datafusion-ballista#1627 (comment)

What changes are included in this PR?

  • Add ExplainFormat to protobuf common definitions.
  • Add the format field to protobuf ExplainNode.
  • Regenerate protobuf code.

Are these changes tested?

Yes, we add a roundtrip test for EXPLAIN FORMAT TREE.

Are there any user-facing changes?

No

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion-proto v53.1.0 (current)
       Built [  59.399s] (current)
     Parsing datafusion-proto v53.1.0 (current)
      Parsed [   0.136s] (current)
    Building datafusion-proto v53.1.0 (baseline)
       Built [  56.929s] (baseline)
     Parsing datafusion-proto v53.1.0 (baseline)
      Parsed [   0.140s] (baseline)
    Checking datafusion-proto v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   1.646s] 222 checks: 221 pass, 1 fail, 0 warn, 30 skip

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field ExplainNode.format in /home/runner/work/datafusion/datafusion/datafusion/proto/src/generated/prost.rs:355
  field ExplainNode.format in /home/runner/work/datafusion/datafusion/datafusion/proto/src/generated/prost.rs:355

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [ 120.352s] datafusion-proto
    Building datafusion-proto-common v53.1.0 (current)
       Built [  22.615s] (current)
     Parsing datafusion-proto-common v53.1.0 (current)
      Parsed [   0.045s] (current)
    Building datafusion-proto-common v53.1.0 (baseline)
       Built [  22.414s] (baseline)
     Parsing datafusion-proto-common v53.1.0 (baseline)
      Parsed [   0.047s] (baseline)
    Checking datafusion-proto-common v53.1.0 -> v53.1.0 (no change; assume patch)
     Checked [   0.962s] 222 checks: 222 pass, 30 skip
     Summary no semver update required
    Finished [  47.757s] datafusion-proto-common

@milenkovicm milenkovicm self-requested a review May 3, 2026 09:12
@danielhumanmod danielhumanmod marked this pull request as ready for review May 3, 2026 17:56
into_logical_plan!(explain.input, ctx, extension_codec)?;
let pb_format = protobuf::ExplainFormat::try_from(explain.format)
.map_err(|_| {
internal_datafusion_err!(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We probably should format the error like so:

let join_type =
protobuf::JoinType::try_from(join.join_type).map_err(|_| {
proto_error(format!(
"Received a JoinNode message with unknown JoinType {}",
join.join_type
))
})?;

  • Using proto error variant, and also including the invalid format for visibility

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good catch, fixed in the latest commit, thanks!

@github-actions github-actions Bot added the auto detected api change Auto detected API change label May 5, 2026
Copy link
Copy Markdown
Contributor

@milenkovicm milenkovicm left a comment

Choose a reason for hiding this comment

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

thanks @danielhumanmod and @Jefffrey for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change proto Related to proto crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants