Skip to content

refactor(proto): migrate ArrowSource serde - #24189

Open
buraksenn wants to merge 1 commit into
apache:mainfrom
buraksenn:23516-proto-arrow
Open

refactor(proto): migrate ArrowSource serde#24189
buraksenn wants to merge 1 commit into
apache:mainfrom
buraksenn:23516-proto-arrow

Conversation

@buraksenn

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Part of epic #23494. Moves ArrowSource protobuf serialization from the central dispatch into the source implementation.

What changes are included in this PR?

Add protobuf serialization and deserialization to ArrowSource and add the required proto feature wiring to datafusion-datasource-arrow.

Repoint the live decode arm to ArrowSource::try_from_proto and remove the old central encode arm. Keep try_into_arrow_scan_physical_plan as a deprecated compatibility wrapper that delegates to the new implementation.

The protobuf wire format remains unchanged.

Are these changes tested?

Yes. The existing roundtrip_arrow_scan coverage passes through the new hooks.

Are there any user-facing changes?

The existing PhysicalPlanNodeExt method remains available as a deprecated compatibility wrapper. There is no immediate API removal or wire-format change.

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

github-actions Bot commented Aug 8, 2026

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 [  51.025s] (current)
     Parsing datafusion-datasource-arrow v54.1.0 (current)
      Parsed [   0.012s] (current)
    Building datafusion-datasource-arrow v54.1.0 (baseline)
       Built [  40.847s] (baseline)
     Parsing datafusion-datasource-arrow v54.1.0 (baseline)
      Parsed [   0.012s] (baseline)
    Checking datafusion-datasource-arrow v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.076s] 223 checks: 223 pass, 30 skip
     Summary no semver update required
    Finished [  94.052s] datafusion-datasource-arrow
    Building datafusion-proto v54.1.0 (current)
       Built [  62.359s] (current)
     Parsing datafusion-proto v54.1.0 (current)
      Parsed [   0.020s] (current)
    Building datafusion-proto v54.1.0 (baseline)
       Built [  62.961s] (baseline)
     Parsing datafusion-proto v54.1.0 (baseline)
      Parsed [   0.020s] (baseline)
    Checking datafusion-proto v54.1.0 -> v54.1.0 (no change; assume patch)
     Checked [   0.243s] 223 checks: 222 pass, 1 fail, 0 warn, 30 skip

--- failure trait_method_marked_deprecated: trait method #[deprecated] added ---

Description:
A trait method is now #[deprecated]. Downstream crates will get a compiler warning when using this method.
        ref: https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-deprecated-attribute
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.49.0/src/lints/trait_method_marked_deprecated.ron

Failed in:
  method try_into_arrow_scan_physical_plan in trait datafusion_proto::physical_plan::PhysicalPlanNodeExt in /home/runner/work/datafusion/datafusion/datafusion/proto/src/physical_plan/mod.rs:1038

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

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

codecov-commenter commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.33333% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.04%. Comparing base (b225ded) to head (2de2dcb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/datasource-arrow/src/source.rs 68.18% 3 Missing and 4 partials ⚠️
datafusion/proto/src/physical_plan/mod.rs 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24189      +/-   ##
==========================================
- Coverage   81.06%   81.04%   -0.02%     
==========================================
  Files        1106     1106              
  Lines      381847   381858      +11     
  Branches   381847   381858      +11     
==========================================
- Hits       309541   309478      -63     
- Misses      54036    54104      +68     
- Partials    18270    18276       +6     

☔ 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.

@adriangb adriangb left a comment

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.

This review was AI-assisted (Claude Code); I ran the checks below myself and read the diff.

LGTM — this is a faithful port and matches the pattern set by #24177 / #24178 / #24169. The deprecated try_into_arrow_scan_physical_plan is reduced to a delegating shim rather than a duplicated body, which is what the epic asks for, and deleting the central encode arm in the same PR is what proves the new hook is actually reached.

Verified locally

On a worktree at the PR head:

check result
clippy -p datafusion-proto --all-targets -- -D warnings (default features) clean
same, --features avro clean
same, --all-features clean
clippy -p datafusion-datasource-arrow --all-targets with and without proto clean
cargo test -p datafusion-proto --test proto_integration 217 passed
Cargo.lock drift after building none

The proto-off build of datafusion-datasource-arrow matters here and it's clean, so the new optional dep is gated correctly.

One thing to watch when this and #24190 are stacked

The two PRs make opposite edits to the same import block. This PR gates FileScanConfig, parse_protobuf_file_scan_config, parse_table_schema_from_proto and serialize_file_scan_config behind #[cfg(feature = "avro")] — correct while the Avro arm is the last remaining user. #24190 removes that arm, and its follow-up commit un-gates the same four. Once both land all four are dead and every one of those #[cfg]s should be deleted, not reconciled. It's a textual conflict so the rebase will surface it; just flagging so it doesn't get merged back into existence.

Pleasant side effect once both are in: try_from_data_source_exec is down to MemorySourceConfig alone.

Non-blocking, filed separately

ArrowSource::format has no wire representation, so a stream-format scan round-trips into a file-format scan — the encode side emits ArrowScan for both variants and decode always rebuilds with new_file_source. Pre-existing, unchanged by this PR, and your try_from_proto doc comment says so explicitly; I filed #24196 with a reproduction. Worth noting that roundtrip_test does not catch it (I checked — the before/after Debug strings compare equal), so it needs a downcast assertion.

Only nit on this PR: the decode doc comment records the lossiness but try_to_proto's doesn't. A one-line mirror there would help the next reader. Not worth another round trip if you'd rather fold it into #24196.

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.

3 participants