Skip to content

docs: update examples in ArrowReaderOptions to use in-memory buffers#9163

Merged
alamb merged 2 commits intoapache:mainfrom
AndreaBozzo:ab/parquet-examples
Jan 14, 2026
Merged

docs: update examples in ArrowReaderOptions to use in-memory buffers#9163
alamb merged 2 commits intoapache:mainfrom
AndreaBozzo:ab/parquet-examples

Conversation

@AndreaBozzo
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #9161

Rationale for this change

This PR applies the feedback from #9116 to make the parquet reader documentation examples more concise and easier to follow.

What changes are included in this PR?

Updated 3 documentation examples in parquet/src/arrow/arrow_reader/mod.rs:

  1. with_schema example 1 - Schema mapping with timestamp
  2. with_schema example 2 - Dictionary encoding preservation
  3. with_virtual_columns example - Virtual columns for row numbers

Changes in each example:

  • Replaced tempfile::tempfile() with Vec::new() for in-memory buffer
  • Added use bytes::Bytes; import
  • Changed ArrowWriter::try_new(file.try_clone()?, ...) to ArrowWriter::try_new(&mut file, ...)
  • Added let file = Bytes::from(file); to convert buffer for reading
  • Added # prefixes to hide setup/imports in rendered docs

The async example in async_reader/mod.rs was intentionally left unchanged since it demonstrates tokio::fs::File usage.

Are there any user-facing changes?

No functional changes, only documentation improvements to make examples smaller and cleaner in rendered docs.

@github-actions github-actions bot added the parquet Changes to the parquet crate label Jan 13, 2026
Copy link
Copy Markdown
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @AndreaBozzo. This looks good, but I wonder if it goes a little too far 🤷

Comment thread parquet/src/arrow/arrow_reader/mod.rs Outdated
Comment thread parquet/src/arrow/arrow_reader/mod.rs Outdated
@AndreaBozzo
Copy link
Copy Markdown
Contributor Author

AndreaBozzo commented Jan 13, 2026

@etseidl Good point, as we are fine-tuning, i'm open to modify it to address maintainers feedbacks

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Jan 13, 2026

I probably mislead @AndreaBozzo -- I defer to @etseidl 🎩

@AndreaBozzo
Copy link
Copy Markdown
Contributor Author

AndreaBozzo commented Jan 13, 2026

I probably mislead @AndreaBozzo -- I defer to @etseidl 🎩

No man actually i have to thank you for catching up on me after last PR, i'm ok the @etseidl call if It matters

arrow_with_schema_doc

preview of with_schema on the latest commit

@etseidl
Copy link
Copy Markdown
Contributor

etseidl commented Jan 13, 2026

Thanks @AndreaBozzo and @alamb, I think this is good to go now. 🚀

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Jan 14, 2026

Thanks @Jefffrey @etseidl and @AndreaBozzo 🚀

The docs are getting pretty good 📰

@alamb alamb merged commit 2ee0fa0 into apache:main Jan 14, 2026
16 checks passed
Dandandan pushed a commit to Dandandan/arrow-rs that referenced this pull request Jan 15, 2026
…pache#9163)

# Which issue does this PR close?

Closes apache#9161

# Rationale for this change

This PR applies the feedback from apache#9116 to make the parquet reader
documentation examples more concise and easier to follow.

# What changes are included in this PR?

Updated 3 documentation examples in
`parquet/src/arrow/arrow_reader/mod.rs`:

1. **`with_schema` example 1** - Schema mapping with timestamp
2. **`with_schema` example 2** - Dictionary encoding preservation
3. **`with_virtual_columns` example** - Virtual columns for row numbers

Changes in each example:
- Replaced `tempfile::tempfile()` with `Vec::new()` for in-memory buffer
- Added `use bytes::Bytes;` import
- Changed `ArrowWriter::try_new(file.try_clone()?, ...)` to
`ArrowWriter::try_new(&mut file, ...)`
- Added `let file = Bytes::from(file);` to convert buffer for reading
- Added `#` prefixes to hide setup/imports in rendered docs

The async example in `async_reader/mod.rs` was intentionally left
unchanged since it demonstrates `tokio::fs::File` usage.

# Are there any user-facing changes?

No functional changes, only documentation improvements to make examples
smaller and cleaner in rendered docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve examples of using parquet reader to be more concise

4 participants