Skip to content

Commit

Permalink
Merge pull request duckdb#11645 from wangxiaoying/ec0
Browse files Browse the repository at this point in the history
Filter out single relation predicates before join ordering
  • Loading branch information
Mytherin authored Apr 15, 2024
2 parents eb9f63a + 1198baa commit 4476a91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CardinalityEstimator {
void PrintRelationToTdomInfo();

private:
bool SingleColumnFilter(FilterInfo &filter_info);
bool SingleRelationFilter(FilterInfo &filter_info);
vector<idx_t> DetermineMatchingEquivalentSets(FilterInfo *filter_info);
//! Given a filter, add the column bindings to the matching equivalent set at the index
//! given in matching equivalent sets.
Expand Down
8 changes: 4 additions & 4 deletions src/optimizer/join_order/cardinality_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void CardinalityEstimator::AddRelationTdom(FilterInfo &filter_info) {
relations_to_tdoms.emplace_back(new_r2tdom);
}

bool CardinalityEstimator::SingleColumnFilter(FilterInfo &filter_info) {
if (filter_info.left_set && filter_info.right_set) {
// Both set
bool CardinalityEstimator::SingleRelationFilter(FilterInfo &filter_info) {
if (filter_info.left_set && filter_info.right_set && filter_info.set.count > 1) {
// Both set and are from different relations
return false;
}
if (EmptyFilter(filter_info)) {
Expand Down Expand Up @@ -100,7 +100,7 @@ void CardinalityEstimator::InitEquivalentRelations(const vector<unique_ptr<Filte
// For each filter, we fill keep track of the index of the equivalent relation set
// the left and right relation needs to be added to.
for (auto &filter : filter_infos) {
if (SingleColumnFilter(*filter)) {
if (SingleRelationFilter(*filter)) {
// Filter on one relation, (i.e string or range filter on a column).
// Grab the first relation and add it to the equivalence_relations
AddRelationTdom(*filter);
Expand Down

0 comments on commit 4476a91

Please sign in to comment.