diff --git a/rust/vectordb/src/table.rs b/rust/vectordb/src/table.rs index d01ceacd..b4641826 100644 --- a/rust/vectordb/src/table.rs +++ b/rust/vectordb/src/table.rs @@ -16,6 +16,7 @@ use std::path::Path; use std::sync::Arc; use arrow_array::{Float32Array, RecordBatchReader}; +use arrow_schema::SchemaRef; use lance::dataset::{Dataset, ReadParams, WriteParams}; use lance::index::IndexType; use snafu::prelude::*; @@ -144,6 +145,16 @@ impl Table { }) } + /// Schema of this Table. + pub fn schema(&self) -> SchemaRef { + Arc::new(self.dataset.schema().into()) + } + + /// Version of this Table + pub fn version(&self) -> u64 { + self.dataset.version().version + } + /// Create index on the table. pub async fn create_index(&mut self, index_builder: &impl VectorIndexBuilder) -> Result<()> { use lance::index::DatasetIndexExt; @@ -350,10 +361,7 @@ mod tests { ..Default::default() }; - table - .add(new_batches, Some(param)) - .await - .unwrap(); + table.add(new_batches, Some(param)).await.unwrap(); assert_eq!(table.count_rows().await.unwrap(), 10); assert_eq!(table.name, "test"); }