Repository navigation
fix(proto): preserve CSV/JSON scan options on roundtrip - #24233
Conversation
…json-scan-options # Conflicts: # datafusion/proto/tests/cases/roundtrip_physical_plan.rs
|
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 #24233 +/- ##
==========================================
- Coverage 81.35% 81.34% -0.01%
==========================================
Files 1117 1117
Lines 397457 397554 +97
Branches 397457 397554 +97
==========================================
+ Hits 323337 323385 +48
- Misses 55208 55253 +45
- Partials 18912 18916 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…json-scan-options
…json-scan-options
kosiew
left a comment
There was a problem hiding this comment.
Thanks for working on this. The overall approach looks good, and preserving these scan options through physical-plan protobuf serialization makes sense.
I found one issue with the CSV terminator representation that I think needs to be addressed before merging. I also left one non-blocking suggestion to strengthen the roundtrip coverage.
02ede80 to
f67bca2
Compare
There was a problem hiding this comment.
Thanks for the follow-up. The issues from the previous review look addressed.
The CSV terminator is now represented as bytes, so arbitrary one-byte values such as 0xFF can roundtrip correctly. The decoder also rejects zero-byte and multi-byte terminators, and the new tests cover both the valid and invalid cases.
The end-to-end compressed scan suggestion is addressed as well. The new gzip JSON-array test serializes and deserializes the physical plan, then executes it successfully, which verifies that the compression and JSON format options make it through to the reader path.
I did not find any new correctness issues in the follow-up changes.
Thanks for addressing the feedback. Looks good to me.
|
Thanks @kosiew and @buraksenn |
Which issue does this PR close?
Rationale for this change
Physical-plan protobuf serialization does not preserve several CSV and JSON scan options. Custom CSV terminators, JSON newline-delimited mode, and file compression therefore revert to their defaults after a roundtrip, which can cause the
decoded plan to read the file incorrectly.
What changes are included in this PR?
terminatortoCsvScanExecNode.newline_delimitedtoJsonScanExecNode.file_compression_typeto the sharedFileScanExecConf.Are these changes tested?
Yes. Extended the CSV and JSON physical-plan roundtrip tests to cover custom terminators, non-newline-delimited JSON, compression, and backward-compatible defaults.
Are there any user-facing changes?
CSV and JSON scans now preserve their format and compression options across protobuf roundtrips. The protobuf changes are additive and backward compatible.
JsonSourcealso gains anis_newline_delimitedgetter.