Skip to content

Commit

Permalink
fix: compute children correlation in compute_cost (#176)
Browse files Browse the repository at this point in the history
The input logical property of a group is not fixed. For example, with
semantic correlation, a join b join c, has a = b = c as output
correlation, but the input might be a = b, a = c, or b = c depending on
which join is performed first. Right now, we just take the first expr in
the group as the input, which is why we are getting the bug that the
equal columns from semantic correlation are the same as the join
condition.

We should reconstruct the input eq columns during `compute_cost` using
children's group id, not during building logical property.
  • Loading branch information
Gun9niR authored May 1, 2024
1 parent 9ef6339 commit 38044e1
Show file tree
Hide file tree
Showing 6 changed files with 353 additions and 400 deletions.
2 changes: 1 addition & 1 deletion optd-datafusion-repr/src/cost/base_cost/agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<
let group_col_refs = optimizer
.get_property_by_group::<ColumnRefPropertyBuilder>(context.group_id, 1);
group_col_refs
.column_refs()
.base_table_column_refs()
.iter()
.take(group_by.len())
.map(|col_ref| match col_ref {
Expand Down
Loading

0 comments on commit 38044e1

Please sign in to comment.