Commit a070982
authored
fix(analyzer): Materialized view join filtering (#26630)
Summary:
When there is a join query that involves materialized view, if the WHERE
predicates includes columns of the join table, it throws a semantic
exception about column cannot be resolved.
Example query:
SELECT * FROM mv JOIN table WHERE table_col1>10
The reason is that When Presto tries to optimize partition filtering for
materialized views, it analyzes the WHERE clause using only the scope of
the materialized view table. This fails when the WHERE clause contains
columns from joined tables that haven't been processed yet.
This PR fixes it by only filtering out columns that belong to the
materialized view during the MV partition filtering optimization. Also
it uses analyzeExpression instead of analyzeWhere to not record this
analysis, so that it won't miss the join table columns with complete
scope.
Differential Revision: D87164277
## Release Notes
Please follow [release notes
guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines)
and fill in the release notes below.
```
== NO RELEASE NOTE ==
```1 parent 874b89c commit a070982
File tree
2 files changed
+116
-27
lines changed- presto-hive/src/test/java/com/facebook/presto/hive
- presto-main-base/src/main/java/com/facebook/presto/sql/analyzer
2 files changed
+116
-27
lines changedLines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
2958 | 2959 | | |
2959 | 2960 | | |
2960 | 2961 | | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
2961 | 3027 | | |
2962 | 3028 | | |
2963 | 3029 | | |
| |||
Lines changed: 50 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2551 | 2551 | | |
2552 | 2552 | | |
2553 | 2553 | | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
2563 | | - | |
2564 | | - | |
2565 | | - | |
2566 | | - | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
2567 | 2561 | | |
2568 | | - | |
2569 | | - | |
2570 | | - | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
2571 | 2600 | | |
2572 | | - | |
2573 | | - | |
2574 | | - | |
2575 | | - | |
2576 | | - | |
| 2601 | + | |
| 2602 | + | |
2577 | 2603 | | |
2578 | 2604 | | |
2579 | | - | |
2580 | | - | |
2581 | | - | |
2582 | | - | |
2583 | | - | |
2584 | | - | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
2585 | 2608 | | |
2586 | 2609 | | |
2587 | 2610 | | |
| |||
0 commit comments