refactor(proto): migrate AvroSource serde - #24190
Conversation
|
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24190 +/- ##
==========================================
- Coverage 81.06% 81.06% -0.01%
==========================================
Files 1106 1106
Lines 381847 381862 +15
Branches 381847 381862 +15
==========================================
+ Hits 309541 309551 +10
+ Misses 54036 54033 -3
- Partials 18270 18278 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
adriangb
left a comment
There was a problem hiding this comment.
This review was AI-assisted (Claude Code); I ran the checks below myself and read the diff.
LGTM. Same shape as #24189 and the earlier Csv/Json/Parquet ports: the deprecated try_into_avro_scan_physical_plan becomes a delegating shim instead of a duplicated body, and the central encode arm is deleted in the same PR so the new hook is genuinely on the path. Thanks for adding roundtrip_avro_scan — Avro was the one file scan with no round-trip coverage at all, so that's a real gap closed rather than a formality.
Verified locally
On a worktree at the PR head:
| check | result |
|---|---|
clippy -p datafusion-proto --all-targets -- -D warnings (default, no avro) |
clean |
same, --features avro |
clean |
same, --all-features |
clean |
clippy -p datafusion-datasource-avro --all-targets with and without proto |
clean |
cargo test -p datafusion-proto --test proto_integration |
217 (no avro) / 218 (--features avro) / 220 (--all-features) passed |
Cargo.lock drift after building |
none |
The 218-vs-217 confirms roundtrip_avro_scan actually runs, and since the central encode arm is gone it can only pass through AvroSource::try_to_proto. Good that 1b43c061 handled the no-feature build of the helper imports — that combination is easy to miss and it's clean.
One thing to watch when this and #24189 are stacked
The two PRs make opposite edits to the same import block. #24189 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 survives); 1b43c061 here un-gates them (correct while the Arrow arm survives). Once both land all four are dead and the #[cfg]s should be deleted rather than reconciled. The rebase will conflict there so it'll be visible — just flagging it.
Non-blocking, filed separately
The #[cfg(not(feature = "avro"))] panic! arm is carried over verbatim and matches the ParquetScan arm from #24169, so this PR is consistent and I wouldn't hold it up. But it aborts the process on peer-supplied bytes, which is the wrong failure mode for a deserializer — not_impl_err! is already the convention a few lines away for ParquetSink. Filed as #24197 (good first issue) covering both arms plus the "a Avro" → "an Avro" wording.
Nit
datafusion/datasource-avro/Cargo.toml puts [features] before [dependencies], while the sibling datasource-arrow change in #24189 puts it at the end. Purely cosmetic, ignore if you like.
1b43c06 to
e5fd7f1
Compare
Which issue does this PR close?
Rationale for this change
Part of epic #23494. Moves
AvroSourceprotobuf serialization from the central dispatch into the source implementation.What changes are included in this PR?
Add protobuf serialization and deserialization to
AvroSourceand add the requiredprotofeature wiring todatafusion-datasource-avro.Repoint the feature-gated live decode arm to
AvroSource::try_from_protoand remove the old central encode arm. Keeptry_into_avro_scan_physical_planas a deprecated compatibility wrapper that delegates to the new implementation.The protobuf wire format remains unchanged.
Are these changes tested?
Yes. Added
roundtrip_avro_scan.Are there any user-facing changes?
The existing
PhysicalPlanNodeExtmethod remains available as a deprecated compatibility wrapper. There is no immediate API removal or wire-format change.