pub struct SqlBatchView { /* private fields */ }Expand description
SQL-defined view updated in batch
Implementations§
Source§impl SqlBatchView
impl SqlBatchView
Sourcepub async fn new(
runtime: Arc<RuntimeEnv>,
view_set_name: Arc<String>,
min_event_time_column: Arc<String>,
max_event_time_column: Arc<String>,
count_src_query: Arc<String>,
extract_query: Arc<String>,
merge_partitions_query: Arc<String>,
lake: Arc<DataLakeConnection>,
view_factory: Arc<ViewFactory>,
session_configurator: Arc<dyn SessionConfigurator>,
update_group: Option<i32>,
max_partition_delta_from_source: TimeDelta,
max_partition_delta_from_merge: TimeDelta,
merger_maker: Option<&(dyn Fn(Arc<RuntimeEnv>, Arc<Schema>) -> Arc<dyn PartitionMerger> + Send + Sync + 'static)>,
) -> Result<SqlBatchView, Error>
pub async fn new( runtime: Arc<RuntimeEnv>, view_set_name: Arc<String>, min_event_time_column: Arc<String>, max_event_time_column: Arc<String>, count_src_query: Arc<String>, extract_query: Arc<String>, merge_partitions_query: Arc<String>, lake: Arc<DataLakeConnection>, view_factory: Arc<ViewFactory>, session_configurator: Arc<dyn SessionConfigurator>, update_group: Option<i32>, max_partition_delta_from_source: TimeDelta, max_partition_delta_from_merge: TimeDelta, merger_maker: Option<&(dyn Fn(Arc<RuntimeEnv>, Arc<Schema>) -> Arc<dyn PartitionMerger> + Send + Sync + 'static)>, ) -> Result<SqlBatchView, Error>
§Arguments
runtime- datafusion runtimeview_set_name- name of the tablemin_event_time_column- min(column) should result in the first timestamp in a dataframemax_event_time_column- max(column) should result in the last timestamp in a dataframecount_src_query- used to count the rows of the underlying data to know if a cached partition is up to dateextract_query- used to extract the source data into a cached partitionmerge_partitions_query- used to merge multiple partitions into a single one (and user queries which are one multiple partitions by default)lake- data lakeview_factory- all views accessible to thecount_src_querysession_configurator- configurator for registering custom tables (e.g., JSON files)update_group- tells the daemon which view should be materialized and in what order
Trait Implementations§
Source§impl Debug for SqlBatchView
impl Debug for SqlBatchView
Source§impl View for SqlBatchView
impl View for SqlBatchView
Source§fn get_view_set_name(&self) -> Arc<String>
fn get_view_set_name(&self) -> Arc<String>
name of the table from the user’s perspective
Source§fn 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’.
Source§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,
SqlBatchView: '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,
SqlBatchView: '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.
Source§fn 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.
Source§fn 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
Source§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,
SqlBatchView: '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,
SqlBatchView: 'async_trait,
jit_update creates or updates process-specific partitions before a query
Source§fn 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>
Source§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,
SqlBatchView: '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,
SqlBatchView: '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,
SqlBatchView: 'async_trait,
Source§fn 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
Source§fn 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
Auto Trait Implementations§
impl Freeze for SqlBatchView
impl !RefUnwindSafe for SqlBatchView
impl Send for SqlBatchView
impl Sync for SqlBatchView
impl Unpin for SqlBatchView
impl !UnwindSafe for SqlBatchView
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].