pub trait View:
Debug
+ Send
+ Sync {
// Required methods
fn get_view_set_name(&self) -> Arc<String>;
fn get_view_instance_id(&self) -> Arc<String>;
fn make_batch_partition_spec<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
existing_partitions: Arc<PartitionCache>,
insert_range: TimeRange,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn PartitionSpec>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_file_schema_hash(&self) -> Vec<u8> ⓘ;
fn get_file_schema(&self) -> Arc<Schema>;
fn jit_update<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
query_range: Option<TimeRange>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn make_time_filter(
&self,
_begin: DateTime<Utc>,
_end: DateTime<Utc>,
) -> Result<Vec<Expr>, Error>;
fn get_time_bounds(&self) -> Arc<dyn DataFrameTimeBounds>;
fn get_update_group(&self) -> Option<i32>;
// Provided methods
fn register_table<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table: MaterializedView,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn merge_partitions<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
partitions_to_merge: Arc<Vec<Partition>>,
partitions_all_views: Arc<PartitionCache>,
insert_range: TimeRange,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn get_max_partition_time_delta(
&self,
_strategy: &PartitionCreationStrategy,
) -> TimeDelta { ... }
}Expand description
A trait for defining a view.
Required Methods§
Sourcefn get_view_set_name(&self) -> Arc<String>
fn get_view_set_name(&self) -> Arc<String>
name of the table from the user’s perspective
Sourcefn get_view_instance_id(&self) -> Arc<String>
fn get_view_instance_id(&self) -> Arc<String>
get_view_instance_id can be a process_id, a stream_id or ‘global’.
Sourcefn make_batch_partition_spec<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
existing_partitions: Arc<PartitionCache>,
insert_range: TimeRange,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn PartitionSpec>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn make_batch_partition_spec<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
existing_partitions: Arc<PartitionCache>,
insert_range: TimeRange,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn PartitionSpec>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
make_batch_partition_spec determines what should be found in an up to date partition. The resulting PartitionSpec can be used to validate existing partitions are create a new one.
Sourcefn get_file_schema_hash(&self) -> Vec<u8> ⓘ
fn get_file_schema_hash(&self) -> Vec<u8> ⓘ
get_file_schema_hash returns a hash (can be a version number, version string, etc.) that allows to identify out of date partitions.
Sourcefn get_file_schema(&self) -> Arc<Schema>
fn get_file_schema(&self) -> Arc<Schema>
get_file_schema returns the schema of the partition file in object storage
Sourcefn jit_update<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
query_range: Option<TimeRange>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn jit_update<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
query_range: Option<TimeRange>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
jit_update creates or updates process-specific partitions before a query
Sourcefn make_time_filter(
&self,
_begin: DateTime<Utc>,
_end: DateTime<Utc>,
) -> Result<Vec<Expr>, Error>
fn make_time_filter( &self, _begin: DateTime<Utc>, _end: DateTime<Utc>, ) -> Result<Vec<Expr>, Error>
make_time_filter returns a set of expressions that will filter out the rows of the partition outside the time range requested.
fn get_time_bounds(&self) -> Arc<dyn DataFrameTimeBounds>
Sourcefn get_update_group(&self) -> Option<i32>
fn get_update_group(&self) -> Option<i32>
tells the daemon which view should be materialized and in what order
Provided Methods§
Sourcefn register_table<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table: MaterializedView,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn register_table<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 SessionContext,
table: MaterializedView,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
register the table in the SessionContext
fn merge_partitions<'life0, 'async_trait>(
&'life0 self,
lakehouse: Arc<LakehouseContext>,
partitions_to_merge: Arc<Vec<Partition>>,
partitions_all_views: Arc<PartitionCache>,
insert_range: TimeRange,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sourcefn get_max_partition_time_delta(
&self,
_strategy: &PartitionCreationStrategy,
) -> TimeDelta
fn get_max_partition_time_delta( &self, _strategy: &PartitionCreationStrategy, ) -> TimeDelta
allow the view to subdivide the requested partition