pub trait View:
Debug
+ Send
+ Sync {
Show 14 methods
// 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<MergeQueryResult, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait { ... }
fn get_merged_partition_sort_order(
&self,
_partitions_to_merge: &[Partition],
) -> Option<Vec<String>> { ... }
fn get_max_partition_time_delta(
&self,
_strategy: &PartitionCreationStrategy,
) -> TimeDelta { ... }
fn get_scan_output_ordering(&self) -> Vec<ScanSortColumn> { ... }
}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<MergeQueryResult, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Sourcefn get_merged_partition_sort_order(
&self,
_partitions_to_merge: &[Partition],
) -> Option<Vec<String>>
fn get_merged_partition_sort_order( &self, _partitions_to_merge: &[Partition], ) -> Option<Vec<String>>
Returns the sort guarantee a merge of partitions_to_merge will actually produce, to be
recorded as the resulting partition’s Partition::sort_order (see
merge::create_merged_partition).
This is a distinct concept from get_scan_output_ordering(): that one is a trusted
scan-ordering declaration consumed during physical planning, while this one is a record of
what a specific merge actually produced, computed purely from the input partitions (before
merge_partitions runs) and independent of whether DataFusion’s elision optimization
happened to succeed for this particular run.
Default: None – no guarantee recorded, ignoring the argument.
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
Sourcefn get_scan_output_ordering(&self) -> Vec<ScanSortColumn>
fn get_scan_output_ordering(&self) -> Vec<ScanSortColumn>
Declares an ordering the view’s partition scan already emits, letting DataFusion
elide redundant Sort nodes for queries that ORDER BY these columns.
Returning a non-empty ordering is a correctness contract the view must guarantee:
- rows within each partition file are already sorted by these columns, AND
- the leading column is the view’s min-event-time column, and partition event-time ranges are non-overlapping (so files concatenate in globally-sorted order).
For ThreadSpansView, the non-overlapping-ranges half of this contract rests on JIT
partitions being sliced in event-time order, which in turn assumes a stream’s blocks are
registered in event-time order — an assumption documented but not enforced (see
thread_spans_view.rs). If that assumption is ever violated, output would be silently
mis-ordered rather than re-sorted, since no Sort node remains once this ordering is
declared.
Default: empty (no declared ordering — DataFusion sorts as usual).