Skip to content
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

Merged
merged 6 commits into from
Mar 12, 2021

Conversation

reltuk
Copy link
Contributor

@reltuk reltuk commented Mar 9, 2021

Only commute join nodes when they are actually safe to commute.

…ctural requirements on left and right joins.

Only commute join nodes when they are actually safe to commute.
@reltuk reltuk requested a review from zachmu March 9, 2021 19:01
Copy link
Member

@zachmu zachmu left a 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

// 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 {
Copy link
Member

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) {
Copy link
Member

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


// 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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

order is valid

reltuk added 3 commits March 12, 2021 12:29
…ressions

sql/{plan,analyzer}: {join,indexed_join}: Update join logic to work within subqueries when query scope is non-empty.
@reltuk reltuk merged commit e9ed139 into master Mar 12, 2021
@Hydrocharged Hydrocharged deleted the aaron/analyzer-join-search-commute-only-when-safe branch December 8, 2021 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants