Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

LEFT OUTER JOIN support #707

Closed
smola opened this issue May 10, 2019 · 3 comments · Fixed by #712
Closed

LEFT OUTER JOIN support #707

smola opened this issue May 10, 2019 · 3 comments · Fixed by #712
Assignees
Labels

Comments

@smola
Copy link
Collaborator

smola commented May 10, 2019

LEFT OUTER JOIN support would be nice.

For gitbase, this might be used to check repositories where a given file is absent. Note that for the use cases I'm trying, getting the LEFT OUTER JOIN resolved in Spark with gitbase-spark-connector would be just fine.

@smola smola added the feature label May 10, 2019
@erizocosmico
Copy link
Contributor

Note that squash rule cannot be applied to left outer join, so even if we implement it, it's going to be significantly slower than an inner join because of that limitation.

With an inner join we know we can have table B derived from table A knowing the relationship between A and B. But if we have to account for all possible values of B, it can't be, so it essentially becomes a cross join with some null columns if a condition is not met.

@erizocosmico erizocosmico self-assigned this May 14, 2019
erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue May 15, 2019
Closes src-d#707

This PR implements LEFT and RIGHT join. Initial issue only required
LEFT join, but the effort to also add support to RIGHT join was
minimal, so it was added as well.

The join iterator, previously inner join iterator, has been generalized
so it can work for all joins and share all the logic in a single
component instead of having three iterators handling the complex logic
of how to compute the joins (in memory, multipass, etc).

The nodes, however, have very subtle differences that make it worthless
to abstract because most methods need to be different. The only abstractable
part was the RowIter method, which was extracted to a function that's
called from InnerJoin, LeftJoin and RightJoin nodes.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue May 15, 2019
Closes src-d#707

This PR implements LEFT and RIGHT join. Initial issue only required
LEFT join, but the effort to also add support to RIGHT join was
minimal, so it was added as well.

The join iterator, previously inner join iterator, has been generalized
so it can work for all joins and share all the logic in a single
component instead of having three iterators handling the complex logic
of how to compute the joins (in memory, multipass, etc).

The nodes, however, have very subtle differences that make it worthless
to abstract because most methods need to be different. The only abstractable
part was the RowIter method, which was extracted to a function that's
called from InnerJoin, LeftJoin and RightJoin nodes.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
@smola
Copy link
Collaborator Author

smola commented May 17, 2019

@erizocosmico I thought a LEFT JOIN could theoretically be squashed if the left table is previous in the iterator chain?

@erizocosmico
Copy link
Contributor

After a deeper thought, yes, in that case it can. It will need a bit of a refactor to make it work, but yes

erizocosmico added a commit to erizocosmico/go-mysql-server that referenced this issue May 24, 2019
Closes src-d#707

This PR implements LEFT and RIGHT join. Initial issue only required
LEFT join, but the effort to also add support to RIGHT join was
minimal, so it was added as well.

The join iterator, previously inner join iterator, has been generalized
so it can work for all joins and share all the logic in a single
component instead of having three iterators handling the complex logic
of how to compute the joins (in memory, multipass, etc).

The nodes, however, have very subtle differences that make it worthless
to abstract because most methods need to be different. The only abstractable
part was the RowIter method, which was extracted to a function that's
called from InnerJoin, LeftJoin and RightJoin nodes.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants