-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fe0852
commit 9a4c6f1
Showing
5 changed files
with
67 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,26 @@ | ||
use crate::storage::memo::SqliteMemo; | ||
use iceberg::{spec::Schema, Catalog, Result, TableIdent}; | ||
use std::sync::Arc; | ||
use iceberg::Catalog; | ||
|
||
#[derive(Debug)] | ||
pub struct OptdCatalog<C> { | ||
// TODO(connor): Do we even need this if `SqliteMemo` is going to implement `Catalog`? | ||
_memo: Arc<SqliteMemo>, | ||
catalog: C, | ||
} | ||
pub trait OptdCatalog: Catalog {} | ||
|
||
impl<C: Catalog> OptdCatalog<C> { | ||
pub fn new(memo: Arc<SqliteMemo>, catalog: C) -> Self { | ||
Self { | ||
_memo: memo, | ||
catalog, | ||
} | ||
} | ||
// impl<C: Catalog> OptdCatalog<C> { | ||
// pub fn new(memo: Arc<SqliteMemo>, catalog: C) -> Self { | ||
// Self { | ||
// _memo: memo, | ||
// catalog, | ||
// } | ||
// } | ||
|
||
pub fn catalog(&self) -> &C { | ||
&self.catalog | ||
} | ||
// pub async fn get_current_table_schema(&self, table_id: &TableIdent) -> Result<Arc<Schema>> { | ||
// let table = self.catalog.load_table(table_id).await?; | ||
// let table_metadata = table.metadata(); | ||
|
||
pub async fn get_current_table_schema(&self, table_id: &TableIdent) -> Result<Arc<Schema>> { | ||
let table = self.catalog.load_table(table_id).await?; | ||
let table_metadata = table.metadata(); | ||
// Ok(table_metadata.current_schema().clone()) | ||
// } | ||
|
||
Ok(table_metadata.current_schema().clone()) | ||
} | ||
// pub async fn num_columns(&self, table_id: &TableIdent) -> Result<usize> { | ||
// let schema = self.get_current_table_schema(table_id).await?; | ||
// let field_ids = schema.identifier_field_ids(); | ||
|
||
pub async fn num_columns(&self, table_id: &TableIdent) -> Result<usize> { | ||
let schema = self.get_current_table_schema(table_id).await?; | ||
let field_ids = schema.identifier_field_ids(); | ||
|
||
Ok(field_ids.len()) | ||
} | ||
} | ||
// Ok(field_ids.len()) | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters