Register materialized views with the planner #115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Connection
.Details
Calcite supports substituting all or parts of a query with a view, which may accelerate queries if the view is materialized. We want Hoptimator to leverage this mechanism when planning a pipeline, which would enable, for example, a pipeline to read from a snapshot rather than a source-of-truth event stream. In that scenario, the snapshot must be registered as a materialization of the event stream.
To that end, these changes enable catalogs to register arbitrary materializations. The K8s catalog naively registers all materialized views this way. We can also easily envision a catalog that registers Iceberg tables corresponding to every Kafka topic, etc.
I haven't been able to verify that the planner actually considers using the materializations, but at least it doesn't complain.
Testing
Existing tests pass. Leaving validation of materializations to future work.