Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Migrated
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao committed Apr 15, 2022
1 parent 937390b commit e98448a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/io/parquet/write/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,13 @@ impl<W: Write> FileWriter<W> {
}

/// Writes the footer of the parquet file. Returns the total size of the file.
pub fn end(self, key_value_metadata: Option<Vec<KeyValue>>) -> Result<(u64, W)> {
pub fn end(&mut self, key_value_metadata: Option<Vec<KeyValue>>) -> Result<u64> {
let key_value_metadata = add_arrow_schema(&self.schema, key_value_metadata);
Ok(self.writer.end(key_value_metadata)?)
}

/// Consumes this writer and returns the inner writer
pub fn into_inner(self) -> W {
self.writer.into_inner()
}
}
4 changes: 2 additions & 2 deletions tests/it/io/parquet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,9 @@ fn integration_write(schema: &Schema, batches: &[Chunk<Arc<dyn Array>>]) -> Resu
for group in row_groups {
writer.write(group?)?;
}
let (_size, writer) = writer.end(None)?;
writer.end(None)?;

Ok(writer.into_inner())
Ok(writer.into_inner().into_inner())
}

type IntegrationRead = (Schema, Vec<Chunk<Arc<dyn Array>>>);
Expand Down
3 changes: 2 additions & 1 deletion tests/it/io/parquet/read_indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ fn read_with_indexes(

writer.start()?;
writer.write(row_group)?;
let (_, data) = writer.end(None)?;
writer.end(None)?;
let data = writer.into_inner();

let mut reader = Cursor::new(data);

Expand Down
4 changes: 2 additions & 2 deletions tests/it/io/parquet/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ fn round_trip(
for group in row_groups {
writer.write(group?)?;
}
let (_size, writer) = writer.end(None)?;
writer.end(None)?;

let data = writer.into_inner();
let data = writer.into_inner().into_inner();

let (result, stats) = read_column(&mut Cursor::new(data), 0, "a1")?;
assert_eq!(array.as_ref(), result.as_ref());
Expand Down

0 comments on commit e98448a

Please sign in to comment.