refactor: remove dataset reference from base table (#2226)

This commit is contained in:
Weston Pace
2025-03-17 06:27:33 -07:00
committed by GitHub
parent a207213358
commit 46a6846d07
2 changed files with 6 additions and 13 deletions

View File

@@ -5,11 +5,11 @@ use std::io::Cursor;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use crate::index::Index;
use crate::index::IndexStatistics;
use crate::query::{QueryFilter, QueryRequest, Select, VectorQueryRequest};
use crate::table::{AddDataMode, AnyQuery, Filter};
use crate::utils::{supported_btree_data_type, supported_vector_data_type};
use crate::{index::Index, table::dataset};
use crate::{DistanceType, Error, Table};
use arrow_array::RecordBatchReader;
use arrow_ipc::reader::FileReader;
@@ -396,9 +396,6 @@ impl<S: HttpSend> BaseTable for RemoteTable<S> {
fn name(&self) -> &str {
&self.name
}
fn dataset(&self) -> &dataset::DatasetConsistencyWrapper {
unimplemented!()
}
async fn version(&self) -> Result<u64> {
self.describe().await.map(|desc| desc.version)
}

View File

@@ -410,8 +410,6 @@ pub trait BaseTable: std::fmt::Display + std::fmt::Debug + Send + Sync {
fn as_any(&self) -> &dyn std::any::Any;
/// Get the name of the table.
fn name(&self) -> &str;
/// Get the dataset of the table.
fn dataset(&self) -> &dataset::DatasetConsistencyWrapper;
/// Get the arrow [Schema] of the table.
async fn schema(&self) -> Result<SchemaRef>;
/// Count the number of rows in this table.
@@ -583,9 +581,11 @@ impl Table {
self.inner.name()
}
/// Get the dataset of the table.
pub fn dataset(&self) -> &dataset::DatasetConsistencyWrapper {
self.inner.dataset()
/// Get the dataset of the table if it is a native table
///
/// Returns None otherwise
pub fn dataset(&self) -> Option<&dataset::DatasetConsistencyWrapper> {
self.inner.as_native().map(|t| &t.dataset)
}
/// Get the arrow [Schema] of the table.
@@ -1865,10 +1865,6 @@ impl BaseTable for NativeTable {
self.name.as_str()
}
fn dataset(&self) -> &dataset::DatasetConsistencyWrapper {
&self.dataset
}
async fn version(&self) -> Result<u64> {
Ok(self.dataset.get().await?.version().version)
}