prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.02k stars 5.36k forks source link

Materialized view query optimization does not handle filters in where clause #18034

Open Sullivan-Patrick opened 2 years ago

Sullivan-Patrick commented 2 years ago

Materialized view optimization should occur if the materialized view represents a domain which is a superset of the base query. However, this does not occur in many cases due to type mismatch failures. These type mismatch exceptions are thrown even when one would expect type coercion to allow for comparison (e.g. comparison between integer and bigint) The line of failure is when DomainTranslator#fromPredicate is called:

https://github.com/prestodb/presto/blob/4cb639c9056a965054ceaa7b51b46a38a82c1749/presto-main/src/main/java/com/facebook/presto/sql/analyzer/MaterializedViewQueryOptimizer.java#L496

An example test failure:

https://github.com/Sullivan-Patrick/presto/commit/9714c95cc9b0ae8cea213ef24c3c0d81c74fabc3

tsafacjo commented 11 months ago

can I take this issue ?

Sullivan-Patrick commented 11 months ago

can I take this issue ?

All yours!