You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New planner rule added to push predicates down in the query representation (FoundationDB#3324)
This introduces a new query planner rule that will be a part of a larger
framework to canonicalize query representations. The rule pushes down
predicates to ensure that they appear as low in the tree as possible.
So, for example, suppose you had a query like:
```sql
SELECT a, b, c
FROM (SELECT a, b, c, d FROM T)
WHERE d = ?
ORDER BY a, b
```
This will produce a new query expression where the `d = ?` is pushed
lower in the graph, something like:
```sql
SELECT a, b, c
FROM (SELECT a, b, c, d FROM T where d = ?)
ORDER BY a, b
```
This simplification helps us during planning to push down predicate
execution to the lowest part of the graph where they can go.
Note that for the moment, this rule has _not_ been added to the default
`PlanningRuleSet`. The reason for this is that some of the rewrite rules
will have weird overlap with some of the other rules, and so we want to
rewrite the query in one phase and then plan and optimize it in another.
The framework for that is not there yet
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/CascadesRuleCall.java
+81-43Lines changed: 81 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -33,14 +33,15 @@
33
33
importcom.google.common.base.Preconditions;
34
34
importcom.google.common.base.Verify;
35
35
importcom.google.common.collect.ImmutableList;
36
+
importcom.google.common.collect.ImmutableSet;
36
37
importcom.google.common.collect.Iterables;
37
38
importcom.google.common.collect.Sets;
38
39
39
40
importjavax.annotation.Nonnull;
40
41
importjava.util.Collection;
41
42
importjava.util.Collections;
42
43
importjava.util.Deque;
43
-
importjava.util.Objects;
44
+
importjava.util.List;
44
45
importjava.util.Optional;
45
46
importjava.util.Set;
46
47
importjava.util.function.Function;
@@ -288,22 +289,53 @@ public EvaluationContext getEvaluationContext() {
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/ExploratoryMemoizer.java
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/matching/structure/QuantifierMatchers.java
Copy file name to clipboardExpand all lines: fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/matching/structure/RecordQueryPlanMatchers.java
0 commit comments