datafusion_materialized_views/lib.rs
1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18#![deny(missing_docs)]
19
20//! `datafusion-materialized-views` implements algorithms and functionality for materialized views in DataFusion.
21
22/// Code for incremental view maintenance against Hive-partitioned tables.
23///
24/// An example of a Hive-partitioned table is the [`ListingTable`](datafusion::datasource::listing::ListingTable).
25/// By analyzing the fragment of the materialized view query pertaining to the partition columns,
26/// we can derive a build graph that relates the files of a materialized views and the files of the tables it depends on.
27///
28/// Two central traits are defined:
29///
30/// * [`ListingTableLike`](materialized::ListingTableLike): a trait that abstracts Hive-partitioned tables in object storage;
31/// * [`Materialized`](materialized::Materialized): a materialized `ListingTableLike` defined by a user-provided query.
32///
33/// Note that all implementations of `ListingTableLike` and `Materialized` must be registered using the
34/// [`register_listing_table`](materialized::register_listing_table) and
35/// [`register_materialized`](materialized::register_materialized) functions respectively,
36/// otherwise the tables may not be detected by the incremental view maintenance code,
37/// including components such as [`FileMetadata`](materialized::file_metadata::FileMetadata),
38/// [`RowMetadataRegistry`](materialized::row_metadata::RowMetadataRegistry), or the
39/// [`mv_dependencies`](materialized::dependencies::mv_dependencies) UDTF.
40///
41/// By default, `ListingTableLike` is implemented for [`ListingTable`](datafusion::datasource::listing::ListingTable),
42pub mod materialized;
43
44/// An implementation of Query Rewriting, an optimization that rewrites queries to make use of materialized views.
45pub mod rewrite;