-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9695fd
commit e36a64a
Showing
7 changed files
with
56 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include "planner/logical_plan/logical_plan.h" | ||
|
||
namespace kuzu { | ||
namespace planner { | ||
|
||
struct JoinOrderUtil { | ||
// Although we do not flatten join key in Build operator computation. We still need to perform | ||
// cardinality and cost estimation based on their flat cardinality. | ||
static uint64_t getJoinKeysFlatCardinality( | ||
const binder::expression_vector& joinNodeIDs, const LogicalPlan& buildPlan); | ||
}; | ||
|
||
} // namespace planner | ||
} // namespace kuzu |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "planner/join_order/join_order_util.h" | ||
|
||
namespace kuzu { | ||
namespace planner { | ||
|
||
uint64_t JoinOrderUtil::getJoinKeysFlatCardinality( | ||
const binder::expression_vector& joinNodeIDs, const LogicalPlan& buildPlan) { | ||
auto schema = buildPlan.getSchema(); | ||
f_group_pos_set unFlatGroupsPos; | ||
for (auto& joinID : joinNodeIDs) { | ||
auto groupPos = schema->getGroupPos(*joinID); | ||
if (!schema->getGroup(groupPos)->isFlat()) { | ||
unFlatGroupsPos.insert(groupPos); | ||
} | ||
} | ||
auto cardinality = buildPlan.getCardinality(); | ||
for (auto groupPos : unFlatGroupsPos) { | ||
cardinality *= schema->getGroup(groupPos)->getMultiplier(); | ||
} | ||
return cardinality; | ||
} | ||
|
||
} // namespace planner | ||
} // namespace kuzu |