-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR brings a filter pushdown heuristic rule, built on @AveryQi115's hybrid scheme. ### Filter Pushdown Rule - This series of rules matches on any filter, and pushes any part of the filter down below a node if possible. - They are registered in the HeuristicsRuleWrapper currently, but they work as cost-based rules as well. ### Helper Functions - `LogOpExpr::new_flattened_nested_logical` creates a new `LogOpExpr` from an `ExprList`, and it flattens any nested `LogOpExpr`s of the same `LogOpType`. - `Expr::rewrite_column_refs` recursively rewrites any `ColumnExpr` in an expression tree, using a provided `rewrite_fn`. - `LogicalJoin::map_through_join` takes in left/right schema sizes, and maps an index to be as it would if it were pushed down to the left or right side of a join. - `LogicalProjection::compute_column_mapping` creates a `ColumnMapping` object from a `LogicalProjection`. - The `ColumnMapping` object has a few methods, but most importantly it has `rewrite_condition`, which given an expr, will rewrite the expression with the projection's mapping. ### Testing Utilities - `new_test_optimizer` creates a new heuristic optimizer, which applies a given rule. It uses a `TpchCatalog`. - `TpchCatalog` is a catalog implementing a couple of tables from the TPC-H schema. It can be extended to have more as needed. - `DummyCostModel` implements a cost model, only giving zero cost. It is used for constructing a cascades optimizer without a real cost model, and isn't used in this PR. - This pull request, using these test optimizer components, pioneers a new testing scheme, based on running a constructed query plan through an optimizer, rather than text-based SQL planner tests, which may be flaky. They also test rules in isolation. --------- Signed-off-by: AveryQi115 <[email protected]> Co-authored-by: AveryQi115 <[email protected]>
- Loading branch information
1 parent
d732a10
commit 3b0e6b7
Showing
15 changed files
with
1,464 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.