Skip to content

Commit

Permalink
Don't flush in the middle (#3374)
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Dec 20, 2022
1 parent 8b84d4d commit c1c97f1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions parquet/src/file/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::format as parquet;
use crate::format::{ColumnIndex, OffsetIndex, RowGroup};
use std::io::{BufWriter, IoSlice};
use std::{io::Write, sync::Arc};
use thrift::protocol::{TCompactOutputProtocol, TOutputProtocol, TSerializable};
use thrift::protocol::{TCompactOutputProtocol, TSerializable};

use crate::basic::PageType;
use crate::column::writer::{
Expand Down Expand Up @@ -230,7 +230,6 @@ impl<W: Write> SerializedFileWriter<W> {
let start_offset = self.buf.bytes_written();
let mut protocol = TCompactOutputProtocol::new(&mut self.buf);
offset_index.write_to_out_protocol(&mut protocol)?;
protocol.flush()?;
let end_offset = self.buf.bytes_written();
// set offset and index for offset index
column_metadata.offset_index_offset = Some(start_offset as i64);
Expand Down Expand Up @@ -282,7 +281,6 @@ impl<W: Write> SerializedFileWriter<W> {
let start_offset = self.buf.bytes_written();
let mut protocol = TCompactOutputProtocol::new(&mut self.buf);
column_index.write_to_out_protocol(&mut protocol)?;
protocol.flush()?;
let end_offset = self.buf.bytes_written();
// set offset and index for offset index
column_metadata.column_index_offset = Some(start_offset as i64);
Expand Down Expand Up @@ -335,7 +333,6 @@ impl<W: Write> SerializedFileWriter<W> {
{
let mut protocol = TCompactOutputProtocol::new(&mut self.buf);
file_metadata.write_to_out_protocol(&mut protocol)?;
protocol.flush()?;
}
let end_pos = self.buf.bytes_written();

Expand Down Expand Up @@ -605,7 +602,6 @@ impl<'a, W: Write> SerializedPageWriter<'a, W> {
{
let mut protocol = TCompactOutputProtocol::new(&mut self.sink);
header.write_to_out_protocol(&mut protocol)?;
protocol.flush()?;
}
Ok(self.sink.bytes_written() - start_pos)
}
Expand Down Expand Up @@ -702,7 +698,6 @@ impl<'a, W: Write> PageWriter for SerializedPageWriter<'a, W> {
metadata
.to_column_metadata_thrift()
.write_to_out_protocol(&mut protocol)?;
protocol.flush()?;
Ok(())
}

Expand Down

0 comments on commit c1c97f1

Please sign in to comment.