Skip to content

Commit

Permalink
Sprinkle Send around
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed May 25, 2023
1 parent 2ce3ecc commit 00028c9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions parquet/src/arrow/arrow_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct ArrowWriter<W: Write> {
max_row_group_size: usize,
}

impl<W: Write> Debug for ArrowWriter<W> {
impl<W: Write + Send> Debug for ArrowWriter<W> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let buffered_memory = self.in_progress_size();
f.debug_struct("ArrowWriter")
Expand All @@ -116,7 +116,7 @@ impl<W: Write> Debug for ArrowWriter<W> {
}
}

impl<W: Write> ArrowWriter<W> {
impl<W: Write + Send> ArrowWriter<W> {
/// Try to create a new Arrow writer
///
/// The writer will fail if:
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/column/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ pub trait PageReader: Iterator<Item = Result<Page>> + Send {
///
/// It is reasonable to assume that all pages will be written in the correct order, e.g.
/// dictionary page followed by data pages, or a set of data pages, etc.
pub trait PageWriter {
pub trait PageWriter: Send {
/// Writes a page into the output stream/sink.
/// Returns `PageWriteSpec` that contains information about written page metrics,
/// including number of bytes, size, number of values, offset, etc.
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/encodings/encoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mod dict_encoder;
///
/// Currently this allocates internal buffers for the encoded values. After done putting
/// values, caller should call `flush_buffer()` to get an immutable buffer pointer.
pub trait Encoder<T: DataType> {
pub trait Encoder<T: DataType>: Send {
/// Encodes data from `values`.
fn put(&mut self, values: &[T::T]) -> Result<()>;

Expand Down
12 changes: 6 additions & 6 deletions parquet/src/file/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl<W: Write> Debug for SerializedFileWriter<W> {
}
}

impl<W: Write> SerializedFileWriter<W> {
impl<W: Write + Send> SerializedFileWriter<W> {
/// Creates new file writer.
pub fn new(buf: W, schema: TypePtr, properties: WriterPropertiesPtr) -> Result<Self> {
let mut buf = TrackedWrite::new(buf);
Expand Down Expand Up @@ -396,7 +396,7 @@ impl<W: Write> SerializedFileWriter<W> {
/// - Once done writing a column, close column writer with `close`
/// - Once all columns have been written, close row group writer with `close` method -
/// it will return row group metadata and is no-op on already closed row group.
pub struct SerializedRowGroupWriter<'a, W: Write> {
pub struct SerializedRowGroupWriter<'a, W: Write + Send> {
descr: SchemaDescPtr,
props: WriterPropertiesPtr,
buf: &'a mut TrackedWrite<W>,
Expand All @@ -412,7 +412,7 @@ pub struct SerializedRowGroupWriter<'a, W: Write> {
on_close: Option<OnCloseRowGroup<'a>>,
}

impl<'a, W: Write> SerializedRowGroupWriter<'a, W> {
impl<'a, W: Write + Send> SerializedRowGroupWriter<'a, W> {
/// Creates a new `SerializedRowGroupWriter` with:
///
/// - `schema_descr` - the schema to write
Expand Down Expand Up @@ -696,7 +696,7 @@ impl<'a, W: Write> SerializedPageWriter<'a, W> {
}
}

impl<'a, W: Write> PageWriter for SerializedPageWriter<'a, W> {
impl<'a, W: Write + Send> PageWriter for SerializedPageWriter<'a, W> {
fn write_page(&mut self, page: CompressedPage) -> Result<PageWriteSpec> {
let page_type = page.page_type();
let start_pos = self.sink.bytes_written() as u64;
Expand Down Expand Up @@ -1266,7 +1266,7 @@ mod tests {
compression: Compression,
) -> crate::format::FileMetaData
where
W: Write,
W: Write + Send,
R: ChunkReader + From<W> + 'static,
{
test_roundtrip::<W, R, Int32Type, _>(
Expand All @@ -1286,7 +1286,7 @@ mod tests {
compression: Compression,
) -> crate::format::FileMetaData
where
W: Write,
W: Write + Send,
R: ChunkReader + From<W> + 'static,
D: DataType,
F: Fn(Row) -> D::T,
Expand Down
2 changes: 1 addition & 1 deletion parquet/src/record/record_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::super::errors::ParquetError;
use super::super::file::writer::SerializedRowGroupWriter;

pub trait RecordWriter<T> {
fn write_to_row_group<W: std::io::Write>(
fn write_to_row_group<W: std::io::Write + Send>(
&self,
row_group_writer: &mut SerializedRowGroupWriter<W>,
) -> Result<(), ParquetError>;
Expand Down

0 comments on commit 00028c9

Please sign in to comment.