This rule will rewrite the materialized view with information about
its invalidation data. In particular, if any of the tables used by the
materialization has been updated since the materialization was created,
it will introduce a filter operator on top of that table in the materialization
definition, making explicit the data contained in it so the rewriting
algorithm can use this information to rewrite the query as a combination of the
outdated materialization data and the new original data in the source tables.
If the data in the source table matches the current data in the snapshot,
no filter is created.
In case of tables supports snapshots the filtering should be performed in the
TableScan operator to read records only from the relevant snapshots.
However, the union rewrite algorithm needs a so-called compensation predicate in
a Filter operator to build the union branch produces the delta records.
After union rewrite algorithm is executed the predicates on SnapshotIds
are pushed down to the corresponding TableScan operator and removed from the Filter
operator. So the reference to the
VirtualColumn.SNAPSHOT_ID is temporary in the
logical plan.