Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invalid examples/documentation in parquet_derive doc #5823

Merged
merged 6 commits into from
Jun 2, 2024

Conversation

Weijun-H
Copy link
Member

Which issue does this PR close?

Closes #5687

Rationale for this change

What changes are included in this PR?

Are there any user-facing changes?

@tustvold
Copy link
Contributor

Perhaps we could change ignore to no_run to ensure these examples are kept up to date?

@Weijun-H Weijun-H force-pushed the fix-parquet-eample branch from 7917561 to a66cd13 Compare May 31, 2024 13:32
@Weijun-H Weijun-H force-pushed the fix-parquet-eample branch from ba9f319 to 604da73 Compare May 31, 2024 13:48
@@ -160,6 +167,7 @@ pub fn parquet_record_writer(input: proc_macro::TokenStream) -> proc_macro::Toke
///
/// pub fn read_some_records() -> Vec<ACompleteRecord> {
/// let mut samples: Vec<ACompleteRecord> = Vec::new();
/// let mut file = tempfile().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// let mut file = tempfile().unwrap();
/// let mut file = todo!();

And same above, would avoid a dependency

Copy link
Member Author

Choose a reason for hiding this comment

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

It does not work.

error[E0277]: the trait bound `(): std::io::Write` is not satisfied
   --> parquet_derive/src/lib.rs:73:19
    |
34  |  let mut writer = SerializedFileWriter::new(file, schema, Default::default()).unwrap();
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::io::Write` is not implemented for `()`
    |
note: required by a bound in `SerializedFileWriter`
   --> /Users/hwj/Desktop/rust/arrow-rs/parquet/src/file/writer.rs:141:36
    |
141 | pub struct SerializedFileWriter<W: Write> {
    |                                    ^^^^^ required by this bound in `SerializedFileWriter`

Copy link
Member Author

Choose a reason for hiding this comment

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

I use std::fs::File to avoid a dependency

@Weijun-H Weijun-H requested a review from tustvold June 1, 2024 03:15
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

Just a minor nit

@@ -160,6 +167,7 @@ pub fn parquet_record_writer(input: proc_macro::TokenStream) -> proc_macro::Toke
///
/// pub fn read_some_records() -> Vec<ACompleteRecord> {
/// let mut samples: Vec<ACompleteRecord> = Vec::new();
/// let mut file = File::open("some_file.parquet").unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect the mut is unnecessary

@@ -62,14 +66,15 @@ mod parquet_field;
/// a_str: "I'm false"
/// }
/// ];
/// let mut file = File::open("some_file.parquet").unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect the mut is unnecessary

@tustvold tustvold merged commit 065151b into apache:master Jun 2, 2024
11 checks passed
@alamb alamb added documentation Improvements or additions to documentation parquet_derive parquet_derive crate labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation parquet_derive parquet_derive crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

parquet_derive: invalid examples/documentation
3 participants