Skip to content

Commit

Permalink
fix: invalid examples/documentation in parquet_derive doc (#5823)
Browse files Browse the repository at this point in the history
* fix: the previous example doesnot work

* chore: change code from ignore to no-run

* chore: Remove dependency

* chore: format

* chore

* chore
  • Loading branch information
Weijun-H authored Jun 2, 2024
1 parent fe071eb commit 065151b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions parquet_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ mod parquet_field;
///
/// Example:
///
/// ```ignore
/// ```no_run
/// use parquet_derive::ParquetRecordWriter;
/// use std::io::{self, Write};
/// use parquet::file::properties::WriterProperties;
/// use parquet::file::writer::SerializedFileWriter;
/// use parquet::record::RecordWriter;
/// use std::fs::File;
///
/// use std::sync::Arc;
///
Expand All @@ -62,14 +66,15 @@ mod parquet_field;
/// a_str: "I'm false"
/// }
/// ];
/// let file = File::open("some_file.parquet").unwrap();
///
/// let schema = samples.as_slice().schema();
/// let schema = samples.as_slice().schema().unwrap();
///
/// let mut writer = SerializedFileWriter::new(file, schema, Default::default()).unwrap();
///
/// let mut row_group = writer.next_row_group().unwrap();
/// samples.as_slice().write_to_row_group(&mut row_group).unwrap();
/// writer.close_row_group(row_group).unwrap();
/// row_group.close().unwrap();
/// writer.close().unwrap();
/// }
/// ```
Expand Down Expand Up @@ -148,9 +153,11 @@ pub fn parquet_record_writer(input: proc_macro::TokenStream) -> proc_macro::Toke
///
/// Example:
///
/// ```ignore
/// ```no_run
/// use parquet::record::RecordReader;
/// use parquet::file::{serialized_reader::SerializedFileReader, reader::FileReader};
/// use parquet_derive::{ParquetRecordReader};
/// use std::fs::File;
///
/// #[derive(ParquetRecordReader)]
/// struct ACompleteRecord {
Expand All @@ -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 file = File::open("some_file.parquet").unwrap();
///
/// let reader = SerializedFileReader::new(file).unwrap();
/// let mut row_group = reader.get_row_group(0).unwrap();
Expand Down

0 comments on commit 065151b

Please sign in to comment.