Skip to content

GH-45394: [C++][Dataset] Read single-line JSON files without a trailing newline - #53263

Closed
nil68657 wants to merge 1 commit into
apache:mainfrom
nil68657:gh-45394-json-single-line
Closed

nil68657 wants to merge 1 commit into
apache:mainfrom
nil68657:gh-45394-json-single-line

Conversation

@nil68657

Copy link
Copy Markdown

Rationale for this change

The dataset JSON reader derived the physical schema from the complete
lines of the first block only. A file holding one object without a
newline produced an empty schema, so every column was read as null.
Parse the whole block when it already covers the entire file.

What changes are included in this PR?

  • cpp/src/arrow/dataset/file_json.cc

Are these changes tested?

Yes. A regression test in cpp/src/arrow/dataset/file_json_test.cc fails without the change and passes with it; the surrounding test module/binary passes.

Are there any user-facing changes?

See the rationale above.

Was AI used for this PR?

This PR is a joint contribution from Nilanjan Chatterjee (@nil68657) and Claude (Claude Opus 5.5, via Claude Code). Nilanjan chose the issue and directed the work; Claude reproduced the bug, wrote the fix, the test and this description.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

…trailing newline

The dataset JSON reader derived the physical schema from the complete
lines of the first block only. A file holding one object without a
newline produced an empty schema, so every column was read as null.
Parse the whole block when it already covers the entire file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the awaiting review Awaiting review label Oct 11, 2026
@github-actions

Copy link
Copy Markdown

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

@thisisnic

Copy link
Copy Markdown
Member

Thanks for the PR. I’m closing it because Arrow’s contributor guidelines require that AI-generated code be reviewed and understood by the person submitting it:

Only submit a PR if you are able to debug and own the changes yourself – review all generated code to understand every detail

Once you’ve reviewed the changes and can own them yourself, you’re welcome to open a new PR.

@thisisnic thisisnic closed this Oct 12, 2026
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