async fn parquet_stream_to_bytes(
        mut stream: SendableRecordBatchStream,
        schema: SchemaRef,
    ) -> Result<Vec<u8>> {
        let mem_writer = MemWriter::default();
        {
            let mut writer = ArrowWriter::try_new(mem_writer.clone(), schema, None)
                .context(OpeningParquetWriter)?;
            while let Some(batch) = stream.next().await {
                let batch = batch.context(ReadingStream)?;
                writer.write(&batch).context(WritingParquetToMemory)?;
            }
            writer.close().context(ClosingParquetWriter)?;
        } // drop the reference to the MemWriter that the SerializedFileWriter has

        Ok(mem_writer
            .into_inner()
            .expect("Nothing else should have a reference here"))
    }
/// Convert the record batches in stream to bytes in a parquet file stream
/// in memory
///
/// TODO: connect the streams to avoid buffering into Vec<u8>
Convert the record batches in stream to bytes in a parquet file stream
in memory

connect the streams to avoid buffering into Vec
Convert the record batches in stream to bytes in a parquet file stream in memory connect the streams to avoid buffering into Vec
async fn parquet_stream_to_bytes(
        mut stream: SendableRecordBatchStream,
        schema: SchemaRef,
    ) -> Result<Vec<u8>> {
        let mem_writer = MemWriter::default();
        {
            let mut writer = ArrowWriter::try_new(mem_writer.clone(), schema, None)
                .context(OpeningParquetWriter)?;
            while let Some(batch) = stream.next().await {
                let batch = batch.context(ReadingStream)?;
                writer.write(&batch).context(WritingParquetToMemory)?;
            }
            writer.close().context(ClosingParquetWriter)?;
        } // drop the reference to the MemWriter that the SerializedFileWriter has
        Ok(mem_writer
            .into_inner()
            .expect("Nothing else should have a reference here"))
    }
async fn parquet_stream_to_bytes ( mut stream : SendableRecordBatchStream , schema : SchemaRef , ) -> Result < Vec < u8 > > { let mem_writer = MemWriter :: default ( ) ; { let mut writer = ArrowWriter :: try_new ( mem_writer . clone ( ) , schema , None ) . context ( OpeningParquetWriter ) ? ; while let Some ( batch ) = stream . next ( ) . await { let batch = batch . context ( ReadingStream ) ? ; writer . write ( & batch ) . context ( WritingParquetToMemory ) ? ; } writer . close ( ) . context ( ClosingParquetWriter ) ? ; } // drop the reference to the MemWriter that the SerializedFileWriter has Ok ( mem_writer . into_inner ( ) . expect ( " " ) ) }
Convert the record batches in stream to bytes in a parquet file stream
in memory
Convert the record batches in stream to bytes in a parquet file stream in memory
stream
SendableRecordBatchStream
schema
SchemaRef
stream
SendableRecordBatchStream
schema
SchemaRef