Skip to content

Deprecate CsvSource::newlines_in_values and preserve proto coverage - #26179

Merged
kosiew merged 2 commits into
apache:mainfrom
kosiew:destructure-proto-01-24612
Oct 11, 2026
Merged

kosiew merged 2 commits into
apache:mainfrom
kosiew:destructure-proto-01-24612

Conversation

@kosiew

@kosiew kosiew commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Deprecate CsvSource::newlines_in_values() as part of the CSV API cleanup while preserving compatibility and existing CSV serialization behavior.

The getter simply returns CsvOptions.newlines_in_values.unwrap_or(false). There is no replacement getter, so callers should retain their original CsvOptions when they need to inspect this setting.

The public getter remains callable during the deprecation window, and CSV reading and repartitioning behavior are unchanged.

What changes are included in this PR?

  • Mark CsvSource::newlines_in_values() as deprecated starting in 56.0.0, with an accurate migration note.
  • Replace the internal encoder's getter call with self.options.newlines_in_values.unwrap_or(false), preserving the existing boolean mapping.
  • Extend roundtrip_csv_scan_preserves_format_options to cover Some(true), Some(false), and None.
  • Assert the protobuf CsvScan.newlines_in_values field after round-tripping the physical plan, while retaining all existing CSV format-option assertions.
  • Preserve malformed terminator validation for empty and two-byte terminators.
  • Document the deprecation and migration guidance in the 56.0.0 upgrade guide.

No protobuf wire-format changes or new public APIs are introduced.

Are these changes tested?

Extended roundtrip_csv_scan_preserves_format_options to verify:

  • Some(true) serializes as true.
  • Some(false) serializes as false.
  • None serializes as false.
  • Existing CSV format options, including delimiter, quote, escape, comment, terminator, truncated rows, header, and GZIP compression, survive the round-trip.
  • Invalid zero-byte and two-byte terminators continue to produce decoding errors.

The patch includes these regression tests, but does not establish whether they have been executed successfully.

Recommended verification commands:

cargo test -p datafusion-proto --test proto_integration roundtrip_csv_scan_preserves_format_options
cargo test -p datafusion-datasource-csv
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
./ci/scripts/doc_prettier_check.sh --write --allow-dirty

Are there any user-facing changes?

CsvSource::newlines_in_values() is deprecated starting in 56.0.0 but remains callable with unchanged behavior.

Existing callers may receive deprecation warnings, potentially affecting downstream builds that treat warnings as errors.

There is no replacement getter. Callers should retain the CsvOptions used to configure the source and read options.newlines_in_values.unwrap_or(false).

The 56.0.0 upgrade guide documents this migration.

CSV parsing, repartitioning, and protobuf serialization behavior are unchanged.

LLM-generated code disclosure

This PR includes LLM-generated code and comments. All LLM-generated content has been manually reviewed.

…de guide

- Getter deprecated since 56.0.0; accurate migration note.
- Encoder uses options directly.
- Proto coverage: true/false/unset; existing assertions retained.
- Upgrade guide updated.
…checks once, retain all three positive roundtrips.

- terminator checks now run only once.
- all three positive roundtrips are retained.
@github-actions github-actions Bot added documentation Improvements or additions to documentation proto Related to proto crate datasource Changes to the datasource crate labels Oct 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-csv v55.1.0 (current)
       Built [  37.727s] (current)
     Parsing datafusion-datasource-csv v55.1.0 (current)
      Parsed [   0.007s] (current)
    Building datafusion-datasource-csv v55.1.0 (baseline)
       Built [  37.647s] (baseline)
     Parsing datafusion-datasource-csv v55.1.0 (baseline)
      Parsed [   0.007s] (baseline)
    Checking datafusion-datasource-csv v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.124s] 223 checks: 222 pass, 1 fail, 0 warn, 31 skip

--- failure type_method_marked_deprecated: type method #[deprecated] added ---

Description:
A type 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.50.0/src/lints/type_method_marked_deprecated.ron

Failed in:
  method datafusion_datasource_csv::source::CsvSource::newlines_in_values in /home/runner/work/datafusion/datafusion/datafusion/datasource-csv/src/source.rs:181

     Summary semver requires new minor version: 0 major and 1 minor checks failed
    Finished [  77.103s] datafusion-datasource-csv
    Building datafusion-proto v55.1.0 (current)
       Built [  47.394s] (current)
     Parsing datafusion-proto v55.1.0 (current)
      Parsed [   0.012s] (current)
    Building datafusion-proto v55.1.0 (baseline)
       Built [  47.077s] (baseline)
     Parsing datafusion-proto v55.1.0 (baseline)
      Parsed [   0.012s] (baseline)
    Checking datafusion-proto v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.134s] 223 checks: 223 pass, 31 skip
     Summary no semver update required
    Finished [  96.320s] datafusion-proto

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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.77%. Comparing base (4e6e564) to head (16118e3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26179      +/-   ##
==========================================
- Coverage   82.77%   82.77%   -0.01%     
==========================================
  Files        1148     1148              
  Lines      451075   451075              
  Branches   451075   451075              
==========================================
- Hits       373397   373387      -10     
- Misses      54930    54940      +10     
  Partials    22748    22748              

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

@kosiew
kosiew marked this pull request as ready for review October 10, 2026 10:58
@kosiew
kosiew requested a review from adriangb October 10, 2026 10:58

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

thanks!

@kosiew
kosiew added this pull request to the merge queue Oct 11, 2026
@kosiew

kosiew commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

🚀
@adriangb
Thank you for your review.

Merged via the queue into apache:main with commit 75ddead Oct 11, 2026
43 checks passed
@kosiew
kosiew deleted the destructure-proto-01-24612 branch October 11, 2026 09:22
Omega359 pushed a commit to Omega359/arrow-datafusion that referenced this pull request Oct 11, 2026
…pache#26179)

## Which issue does this PR close?

- Part of apache#24612

## Rationale for this change

Deprecate `CsvSource::newlines_in_values()` as part of the CSV API
cleanup while preserving compatibility and existing CSV serialization
behavior.

The getter simply returns
`CsvOptions.newlines_in_values.unwrap_or(false)`. There is no
replacement getter, so callers should retain their original `CsvOptions`
when they need to inspect this setting.

The public getter remains callable during the deprecation window, and
CSV reading and repartitioning behavior are unchanged.

## What changes are included in this PR?

- Mark `CsvSource::newlines_in_values()` as deprecated starting in
56.0.0, with an accurate migration note.
- Replace the internal encoder's getter call with
`self.options.newlines_in_values.unwrap_or(false)`, preserving the
existing boolean mapping.
- Extend `roundtrip_csv_scan_preserves_format_options` to cover
`Some(true)`, `Some(false)`, and `None`.
- Assert the protobuf `CsvScan.newlines_in_values` field after
round-tripping the physical plan, while retaining all existing CSV
format-option assertions.
- Preserve malformed terminator validation for empty and two-byte
terminators.
- Document the deprecation and migration guidance in the 56.0.0 upgrade
guide.

No protobuf wire-format changes or new public APIs are introduced.

## Are these changes tested?

Extended `roundtrip_csv_scan_preserves_format_options` to verify:

- `Some(true)` serializes as `true`.
- `Some(false)` serializes as `false`.
- `None` serializes as `false`.
- Existing CSV format options, including delimiter, quote, escape,
comment, terminator, truncated rows, header, and GZIP compression,
survive the round-trip.
- Invalid zero-byte and two-byte terminators continue to produce
decoding errors.

The patch includes these regression tests, but does not establish
whether they have been executed successfully.

Recommended verification commands:

```bash
cargo test -p datafusion-proto --test proto_integration roundtrip_csv_scan_preserves_format_options
cargo test -p datafusion-datasource-csv
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
./ci/scripts/doc_prettier_check.sh --write --allow-dirty
```

## Are there any user-facing changes?

`CsvSource::newlines_in_values()` is deprecated starting in 56.0.0 but
remains callable with unchanged behavior.

Existing callers may receive deprecation warnings, potentially affecting
downstream builds that treat warnings as errors.

There is no replacement getter. Callers should retain the `CsvOptions`
used to configure the source and read
`options.newlines_in_values.unwrap_or(false)`.

The 56.0.0 upgrade guide documents this migration.

CSV parsing, repartitioning, and protobuf serialization behavior are
unchanged.

## LLM-generated code disclosure

This PR includes LLM-generated code and comments. All LLM-generated
content has been manually reviewed.
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 documentation Improvements or additions to documentation proto Related to proto crate v56.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants