pub struct SchemaManager { /* private fields */ }Expand description
Manager for versioned table schema files.
Each table stores schema versions as JSON files under {table_path}/schema/schema-{id}.
When a schema evolution occurs (e.g. ADD COLUMN, ALTER COLUMN TYPE), a new schema file
is written with an incremented ID. Data files record which schema they were written with
via DataFileMeta.schema_id.
The schema cache is shared across clones via Arc, so multiple readers
(e.g. parallel split streams) benefit from a single cache.
Reference: org.apache.paimon.schema.SchemaManager
Implementations§
Source§impl SchemaManager
impl SchemaManager
pub fn new(file_io: FileIO, table_path: String) -> Self
Sourcepub fn with_branch(&self, branch_name: &str) -> Self
pub fn with_branch(&self, branch_name: &str) -> Self
Create a SchemaManager for a branch of this table.
Sourcepub fn schema_path(&self, schema_id: i64) -> String
pub fn schema_path(&self, schema_id: i64) -> String
Path to a specific schema file (e.g. {table_path}/schema/schema-0).
Sourcepub async fn list_all_ids(&self) -> Result<Vec<i64>>
pub async fn list_all_ids(&self) -> Result<Vec<i64>>
List all schema ids sorted ascending. Returns an empty vector if the schema directory is missing or empty.
Mirrors Java SchemaManager.listAllIds().
Sourcepub async fn list_all(&self) -> Result<Vec<Arc<TableSchema>>>
pub async fn list_all(&self) -> Result<Vec<Arc<TableSchema>>>
List all schemas sorted by id ascending.
Mirrors Java SchemaManager.listAll().
Sourcepub async fn latest(&self) -> Result<Option<Arc<TableSchema>>>
pub async fn latest(&self) -> Result<Option<Arc<TableSchema>>>
Return the schema with the highest id, or None when no schema files
exist under the schema directory.
Mirrors Java SchemaManager.latest().
Sourcepub async fn schema(&self, schema_id: i64) -> Result<Arc<TableSchema>>
pub async fn schema(&self, schema_id: i64) -> Result<Arc<TableSchema>>
Load a schema by ID. Returns cached version if available.
The cache is shared across all clones of this SchemaManager, so loading
a schema in one stream makes it available to all other streams reading
from the same table.
Reference: SchemaManager.schema(long)
Trait Implementations§
Source§impl Clone for SchemaManager
impl Clone for SchemaManager
Source§fn clone(&self) -> SchemaManager
fn clone(&self) -> SchemaManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SchemaManager
impl !UnwindSafe for SchemaManager
impl Freeze for SchemaManager
impl Send for SchemaManager
impl Sync for SchemaManager
impl Unpin for SchemaManager
impl UnsafeUnpin for SchemaManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSend for Twhere
T: Send,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.