...
By default, Hive will attempt to rebuild a materialized view incrementally, falling back to full rebuild if it is not possible.
Current Current implementation only supports incremental rebuild when there were were INSERT
operations over the source tables, while UPDATE
and DELETE
operations will force a full rebuild of the materialized view.
To execute incremental maintenance, following conditions should be met if there were only INSERT
operations over the source tables:
- The materialized view should only use transactional tables (the source tables must be transactional), either micromanaged or ACID or a storage format that supports snapshots (ex. Iceberg)
- If the materialized view definition contains a Group By clause, the materialized view should be stored in an ACID table or a storage format that supports snapshots (ex. Iceberg v2), since it needs to support MERGE operation. For materialized view definitions consisting of Scan-Project-Filter-Join, this restriction does not exist.
...
- If the materialized view definition contains a Group By clause the following aggregate functions are supported: COUNT, SUM, AVG (only if both COUNT and SUM defined for the same column), MIN, MAX
If there were UPDATE
and DELETE
operations over the source tables:
- The materialized view should only use transactional tables (the source tables must be transactional), either micromanaged or ACID
- The materialized view definition must contain a Group By clause and a COUNT(*) function call.
- The materialized view should be stored in an ACID table or a storage format that supports snapshots (ex. Iceberg v2), since it needs to support MERGE operation.
- The following aggregate functions are supported: COUNT, SUM, AVG (only if both COUNT and SUM defined for the same column)
A rebuild operation acquires an exclusive write lock over the materialized view, i.e., for a given materialized view, only one rebuild operation can be executed at a given time.
...