use std::sync::Arc;
use arrow::{array::ArrayRef, datatypes::Schema, record_batch::RecordBatchOptions};
pub trait ExonArrayBuilder {
fn finish(&mut self) -> Vec<ArrayRef>;
fn try_into_record_batch(
&mut self,
schema: Arc<Schema>,
) -> arrow::error::Result<arrow::record_batch::RecordBatch> {
let columns = self.finish();
let options = RecordBatchOptions::default().with_row_count(Some(self.len()));
let record_batch =
arrow::record_batch::RecordBatch::try_new_with_options(schema, columns, &options)?;
Ok(record_batch)
}
fn len(&self) -> usize;
fn is_empty(&self) -> bool {
self.len() == 0
}
}