Struct lance_core::io::writer::FileWriter
source · pub struct FileWriter { /* private fields */ }Expand description
FileWriter writes Arrow RecordBatch to one Lance file.
use lance::io::FileWriter;
use futures::stream::Stream;
let mut file_writer = FileWriter::new(object_store, &path, &schema);
while let Ok(batch) = stream.next().await {
file_writer.write(&batch).unwrap();
}
// Need to close file writer to flush buffer and footer.
file_writer.shutdown();
Implementations§
source§impl FileWriter
impl FileWriter
pub async fn try_new( object_store: &ObjectStore, path: &Path, schema: Schema, options: &FileWriterOptions ) -> Result<Self>
pub fn with_object_writer( object_writer: ObjectWriter, schema: Schema, options: &FileWriterOptions ) -> Result<Self>
sourcepub async fn write(&mut self, batches: &[RecordBatch]) -> Result<()>
pub async fn write(&mut self, batches: &[RecordBatch]) -> Result<()>
Write a RecordBatch to the open file. All RecordBatch will be treated as one RecordBatch on disk
Returns Err if the schema does not match with the batch.
pub async fn finish(&mut self) -> Result<usize>
sourcepub fn multipart_id(&self) -> &str
pub fn multipart_id(&self) -> &str
Returns the in-flight multipart ID.
sourcepub fn next_batch_id(&self) -> i32
pub fn next_batch_id(&self) -> i32
Return the id of the next batch to be written.
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl !RefUnwindSafe for FileWriter
impl Send for FileWriter
impl !Sync for FileWriter
impl Unpin for FileWriter
impl !UnwindSafe for FileWriter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more