-
-
Notifications
You must be signed in to change notification settings - Fork 212
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
sql/analyzer: join_search: Update indexed join search to respect structural requirements on left and right joins. #329
sql/analyzer: join_search: Update indexed join search to respect structural requirements on left and right joins. #329
Conversation
…ctural requirements on left and right joins. Only commute join nodes when they are actually safe to commute.
…-search-commute-only-when-safe
…ithin subqueries when query scope is non-empty.
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.
Looks great, just missing some unit tests for the new left / right logic
sql/analyzer/indexed_joins.go
Outdated
// set in `commutes`, and a left or right join gets a node with a | ||
// `left` and a `right` child. original on the left and the new table | ||
// being joined on the right. | ||
func newJoinOrderNode(node sql.Node) *joinOrderNode { |
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.
Probably belongs in join_search.go
@@ -21,12 +21,13 @@ import ( | |||
"github.com/stretchr/testify/assert" | |||
|
|||
"github.com/dolthub/go-mysql-server/sql" | |||
"github.com/dolthub/go-mysql-server/sql/plan" | |||
) | |||
|
|||
func TestBuildJoinTree(t *testing.T) { |
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.
Need some new test cases that exercise the left and right join table ordering semantics you added
sql/analyzer/join_search.go
Outdated
|
||
// applyJoinHint will set the `jo.order` fields of the root node and | ||
// the internal nodes of the joinOrderNode to the order in the | ||
// provided `hint`, presuming that order to valid. If it is not valid, |
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.
order is valid
…des with left and right children.
…ressions sql/{plan,analyzer}: {join,indexed_join}: Update join logic to work within subqueries when query scope is non-empty.
Only commute join nodes when they are actually safe to commute.