Hi Contributors, I'm writing this email and hope to start a discussion about https://issues.apache.org/jira/browse/CALCITE-3334 .
The approach of substitution-based materialized view matching is effective for its simplicity and extensibility. But now and then we confront materialization matching failures especially for SQLs with multiple nested levels. We keep thinking that how many more rules still need to be added and can we enumerate all the common matching patterns. The existing rules in SubstitutionVisitor & MaterializedViewSubstitutionVisitor are created by heuristic and experience. They are quite straightforward. But from my understanding the design of rule set is not systematic enough. Especially compensating Project or Filter are not given enough good care. I raised a doc -- https://docs.google.com/document/d/1JpwGNFE3hw3yXb7W3-95-jXKClZC5UFPKbuhgYDuEu4 to propose refinement for substitution-based materialized view matching from two aspects: 1. Canonicalize before materialization matching; 2. Separate matching rules into two categories and enumerate matching patterns which need to be covered by rules. It's great if you can share some comments on this. Best, Jin