-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[memo] RequiredIndex interface #2238
Conversation
Some table nodes need to be executed as IndexScans with mandatory filters. The new interface makes this transparent to join planning.
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.
Good solution just a few comments
// IndexRequired tables cannot be executed without index lookups on certain | ||
// columns. Join planning uses this interface to maintain plan correctness | ||
// for these nodes | ||
type IndexRequired interface { |
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.
Good interface, good name
sql/memo/rel_props.go
Outdated
p.reqIdxCols = rel.Child.RelProps.reqIdxCols | ||
case *Filter: | ||
p.reqIdxCols = rel.Child.RelProps.reqIdxCols | ||
default: |
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.
No empty default
@@ -167,6 +170,26 @@ func (m *Memo) MemoizeLookupJoin(grp, left, right *ExprGroup, op plan.JoinType, | |||
return grp | |||
} | |||
|
|||
func (m *Memo) MemoizeHashJoin(grp *ExprGroup, join *JoinBase, toExpr, fromExpr []sql.Expression) *ExprGroup { | |||
if join.Right.RelProps.reqIdxCols.Len() > 0 { |
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.
Comment about this logic would help
sql/memo/memo.go
Outdated
@@ -143,6 +143,9 @@ func (m *Memo) MemoizeInnerJoin(grp, left, right *ExprGroup, op plan.JoinType, f | |||
} | |||
|
|||
func (m *Memo) MemoizeLookupJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression, lookup *IndexScan) *ExprGroup { | |||
if left.RelProps.reqIdxCols.Union(right.RelProps.reqIdxCols).Difference(lookup.Index.set).Len() > 0 { |
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.
Comment about this logic would help
Some table nodes need to be executed as IndexScans with mandatory filters. The new interface makes this transparent to join planning.
re: dolthub/dolt#7256