Skip to content

fix(proto): preserve Arrow IPC stream format - #24224

Open
buraksenn wants to merge 1 commit into
apache:mainfrom
buraksenn:24196-preserve-arrow-ipc-format
Open

fix(proto): preserve Arrow IPC stream format#24224
buraksenn wants to merge 1 commit into
apache:mainfrom
buraksenn:24196-preserve-arrow-ipc-format

Conversation

@buraksenn

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

ArrowSource distinguishes between Arrow IPC file and stream formats, but this format was not serialized. As a result, a stream scan round-tripped through protobuf as a file scan, selecting the wrong opener and potentially allowing unsupported range-based repartitioning.

What changes are included in this PR?

  • Add an ArrowIpcFormat discriminator to ArrowScanExecNode.
  • Serialize and restore the ArrowSource IPC format.
  • Decode payloads without the new field as file format, preserving the previous behavior.
  • Regenerate the prost and pbjson models.
  • Add regression coverage for file, stream, and older payloads without the format field.

Are these changes tested?

Yes:

  • cargo test -p datafusion-proto --test proto_integration roundtrip_arrow
  • cargo test -p datafusion-proto --test proto_integration arrow_scan_without_format_field_decodes_as_file_format
  • cargo fmt --all
  • Targeted all-feature clippy for datafusion-datasource-arrow and datafusion-proto

Are there any user-facing changes?

Arrow IPC stream scans now preserve their format across protobuf round trips.

The binary protobuf change is additive. Older payloads continue to decode as file format. Stream preservation requires both producer and consumer to include this change because older versions do not carry or read the discriminator. The generated Rust ArrowScanExecNode struct gains a format field.

@github-actions github-actions Bot added proto Related to proto crate datasource Changes to the datasource crate labels Aug 10, 2026
@github-actions

Copy link
Copy Markdown

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-datasource-arrow v54.1.0 (current)
       Built [  45.538s] (current)
     Parsing datafusion-datasource-arrow v54.1.0 (current)
      Parsed [   0.013s] (current)
    Building datafusion-datasource-arrow v54.1.0 (baseline)
       Built [  44.991s] (baseline)
     Parsing datafusion-datasource-arrow v54.1.0 (baseline)
      Parsed [   0.013s] (baseline)
    Checking datafusion-datasource-arrow v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.097s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [  92.324s] datafusion-datasource-arrow
    Building datafusion-proto v54.1.0 (current)
       Built [  63.593s] (current)
     Parsing datafusion-proto v54.1.0 (current)
      Parsed [   0.021s] (current)
    Building datafusion-proto v54.1.0 (baseline)
       Built [  63.062s] (baseline)
     Parsing datafusion-proto v54.1.0 (baseline)
      Parsed [   0.022s] (baseline)
    Checking datafusion-proto v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.316s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [ 128.501s] datafusion-proto
    Building datafusion-proto-models v54.1.0 (current)
       Built [  25.756s] (current)
     Parsing datafusion-proto-models v54.1.0 (current)
      Parsed [   0.138s] (current)
    Building datafusion-proto-models v54.1.0 (baseline)
       Built [  25.474s] (baseline)
     Parsing datafusion-proto-models v54.1.0 (baseline)
      Parsed [   0.141s] (baseline)
    Checking datafusion-proto-models v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   2.396s] 223 checks: 222 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.49.0/src/lints/constructible_struct_adds_field.ron

Failed in:
  field ArrowScanExecNode.format in /home/runner/work/datafusion/datafusion/datafusion/proto-models/src/generated/prost.rs:1989
  field ArrowScanExecNode.format in /home/runner/work/datafusion/datafusion/datafusion/proto-models/src/generated/prost.rs:1989

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  55.321s] datafusion-proto-models

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Aug 10, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 8.23529% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.96%. Comparing base (2bfdd4a) to head (2c7b08b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/proto-models/src/generated/pbjson.rs 0.00% 61 Missing ⚠️
datafusion/proto-models/src/generated/prost.rs 0.00% 13 Missing ⚠️
datafusion/datasource-arrow/src/source.rs 63.63% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24224      +/-   ##
==========================================
- Coverage   80.99%   80.96%   -0.03%     
==========================================
  Files        1106     1106              
  Lines      383158   383315     +157     
  Branches   383158   383315     +157     
==========================================
+ Hits       310331   310367      +36     
- Misses      54513    54626     +113     
- Partials    18314    18322       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +1293 to +1301
enum ArrowIpcFormat {
// Unset in payloads encoded before this field existed; decoded as the
// IPC file format for backward compatibility.
ARROW_IPC_FORMAT_UNSPECIFIED = 0;
// Arrow IPC file format (with footer, supports range-based parallel reading)
ARROW_IPC_FORMAT_FILE = 1;
// Arrow IPC stream format (without footer, sequential reading only)
ARROW_IPC_FORMAT_STREAM = 2;
}

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.

if ARROW_IPC_FORMAT_UNSPECIFIED exist for the sake of backwards compatiability cant the default value be set to ARROW_IPC_FORMAT_FILE. this way we dont need a third variant especially since it will be interpreted as ARROW_IPC_FORMAT_FILE anyway?

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 datasource Changes to the datasource crate proto Related to proto crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arrow IPC stream format is silently lost when a scan is serialized to protobuf

3 participants