This repository was archived by the owner on Jan 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Subquery Unnesting: Exists + In Support #259
Merged
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
99ed87e
Add all tpch queries (from risinglightdb tests)
jurplel 5e4f33a
Newline normalization
jurplel 298ab67
Fix BinOp schema property issue
jurplel 6547052
tpch q11 fix
jurplel b62ce72
Merge branch 'bowad/tpch-q11-fix' of github.com:cmu-db/optd into bowa…
jurplel 768982d
Update sqlplannertest plans
jurplel 52359fa
Merge branch 'main' into bowad/tpch-q11-fix
jurplel 01774d1
Delete q11 again
jurplel 4c2c7fd
fix a couple of depjoin agg pushdown bugs
jurplel 66a310d
un-disable tpch-q17
jurplel 21d490a
Fix another bug w/ init distinct
jurplel f4108b3
Write comment for init distinct fix
jurplel a945abf
Merge
jurplel f055605
Update sqlplannertest plans
jurplel 0dcce3d
Add test for out-of-order extern columns in subquery
jurplel b468692
add unnest test w/ nulls from agg
jurplel 78c2b5e
Implement outer join agg null fix
jurplel 9edf1af
Count(*) fix
jurplel bab134f
Merge branch 'main' into bowad/unnest-agg-null-fix
jurplel b0b9e4e
planner test updates
jurplel 9778e25
clippy
jurplel 87c9c09
Unused variable
jurplel 59ee25b
Initial correlated EXISTS support
jurplel 712f320
Avoid self join issue in adv cost model
jurplel 6310156
Merge branch 'bowad/unnest-agg-null-fix' into bowad/unnest-exists
jurplel 5e283ce
Q4 working
jurplel ee74f94
Q4
jurplel c37a3e5
Update sqlplannertest plans
jurplel 2ef7682
Support for NOT EXISTS + simplify approach somewhat...not sure this w…
jurplel 50ac700
Better simulate mark join by using left outer join + more complex test
jurplel b101fd7
Make it more complicated & more correct + schema modifications
jurplel c2c908e
Fix NULL not printing
jurplel 0d33ef3
Add in tests
jurplel 951fbd2
Merge branch 'bowad/unnest-agg-null-fix' into bowad/unnest-exists
jurplel b9c70ee
merge w/ main (and tests are failing)
jurplel 0fc8cb9
Fix not passing all columns through (I think this was a bug?)
jurplel 7d84912
Merge branch 'bowad/unnest-agg-null-fix' into bowad/unnest-exists
jurplel f94650a
Update planner tests
jurplel 1f0a7e7
Q4 is working
jurplel 61bbb91
Merge
jurplel d5a6a47
mark join support
jurplel 5f87473
Implement exists w/ mark join
jurplel fa3e99c
maybe more correct IN?
jurplel d753945
Handle correlated IN (hopefully) properly, now
jurplel f9aaccb
Assign TODO to myself
jurplel 20bd190
update in exists to be correlated
jurplel 41867f3
Uncorrelated IN
jurplel 3a93414
Q16 working
jurplel 8876883
Unnesting of correlated EXISTS clauses
jurplel 83efff6
Update planner tests
jurplel 9b9152c
Cleanup
jurplel 3f03aca
Clippy
jurplel beec1ea
Change to dbg assert
jurplel fa7e41e
One more clippy warning...
jurplel 34e70f0
Fix assertion bug for Q20 and Q22
jurplel b741c83
Add new queries to sqlplannertest + delete extraneous file
jurplel bcc28c9
Merge branch 'main' into bowad/unnest-exists
jurplel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -66,7 +66,10 @@ impl< | |
) -> f64 { | ||
match &expr_tree.typ { | ||
DfPredType::Constant(_) => Self::get_constant_selectivity(expr_tree), | ||
DfPredType::ColumnRef => unimplemented!("check bool type or else panic"), | ||
DfPredType::ColumnRef => { | ||
// TODO: Check that field is of bool type | ||
0.5 // TODO: placeholder---how can we get the selectivity? | ||
} | ||
DfPredType::UnOp(un_op_typ) => { | ||
assert!(expr_tree.children.len() == 1); | ||
let child = expr_tree.child(0); | ||
|
@@ -104,7 +107,10 @@ impl< | |
DfPredType::LogOp(log_op_typ) => { | ||
self.get_log_op_selectivity(*log_op_typ, &expr_tree.children, schema, column_refs) | ||
} | ||
DfPredType::Func(_) => unimplemented!("check bool type or else panic"), | ||
DfPredType::Func(_) => { | ||
// TODO: Check that field is of bool type | ||
0.5 // TODO: placeholder---how can we get the selectivity? | ||
Comment on lines
+111
to
+112
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
} | ||
DfPredType::SortOrder(_) => { | ||
panic!("the selectivity of sort order expressions is undefined") | ||
} | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -198,6 +198,8 @@ impl< | |
); | ||
join_filter_selectivity | ||
} | ||
// TODO: Does this make sense? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
JoinType::LeftMark => f64::max(inner_join_selectivity, 1.0 / right_row_cnt), | ||
_ => unimplemented!("join_typ={} is not implemented", join_typ), | ||
} | ||
} | ||
|
@@ -359,7 +361,11 @@ impl< | |
&self, | ||
base_col_refs: HashSet<BaseTableColumnRef>, | ||
) -> f64 { | ||
assert!(base_col_refs.len() > 1); | ||
// Hack to avoid issue w/ self joins...unsure if this is a good idea | ||
if base_col_refs.len() <= 1 { | ||
return 1.0; | ||
} | ||
|
||
let num_base_col_refs = base_col_refs.len(); | ||
base_col_refs | ||
.into_iter() | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -20,6 +20,7 @@ pub enum JoinType { | |
RightSemi, | ||
LeftAnti, | ||
RightAnti, | ||
LeftMark, | ||
} | ||
|
||
impl Display for JoinType { | ||
|
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be addressed