Skip to content

GH-38217: [R] Map format = "text to format = "csv" in write_dataset()#50367

Draft
thisisnic wants to merge 1 commit into
apache:mainfrom
thisisnic:worktree-GH-38217-text-to-csv
Draft

GH-38217: [R] Map format = "text to format = "csv" in write_dataset()#50367
thisisnic wants to merge 1 commit into
apache:mainfrom
thisisnic:worktree-GH-38217-text-to-csv

Conversation

@thisisnic

@thisisnic thisisnic commented Jul 4, 2026

Copy link
Copy Markdown
Member

Rationale for this change

write_dataset() errors on format="text" even though open_dataset() allows it.

What changes are included in this PR?

Map "text" to "csv" so write_dataset() mirrors open_dataset()

Are these changes tested?

Yes

Are there any user-facing changes?

No

@thisisnic thisisnic requested a review from jonkeane as a code owner July 4, 2026 22:15
Copilot AI review requested due to automatic review settings July 4, 2026 22:15
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #38217 has been automatically assigned in GitHub to PR creator.

Copilot AI 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.

Pull request overview

This PR aligns the R write_dataset() format handling with open_dataset() by treating format = "text" as an alias of CSV, so users can write delimited text datasets with the same expectations as when opening them.

Changes:

  • Map format = "text" to "csv" inside write_dataset() so it uses CSV defaults (notably comma delimiter) and generates .csv filenames.
  • Narrow the “delimiter required” validation to only apply to format = "txt", avoiding the previous error for format = "text".
  • Update tests to cover the new format = "text" behavior and remove the old expectation that it errors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
r/R/dataset-write.R Adds text -> csv mapping and updates delimiter validation to only enforce a delimiter for txt.
r/tests/testthat/test-dataset-write.R Replaces the previous error expectation for format="text" with a round-trip test asserting .csv output and correct data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants