mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-10 05:42:58 +00:00
refactor: remove dataset reference from base table (#2226)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user