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

sql/(plan,analyzer): implement pushdown of filters and cols #86

Merged
merged 2 commits into from
Mar 12, 2018

Conversation

erizocosmico
Copy link
Contributor

@erizocosmico erizocosmico commented Mar 7, 2018

Depends on #82

Closes #27
Closes #28

Supersedes #83

Implementation details

Only columns and filters that apply to a column are pushed down to that column. That is, if you have 42 > 5 that filter will not be pushed down to any table, and if you have a.foo = 5 that filter will only be pushed down to table a.

If more than one table is mentioned in a filter, it's not pushed down to neither. E.g. a.foo = b.foo is not pushed down.

Perhaps we want the opposite and we want all filters pushed down to the table, regardless of whether it mentions the table or not?

Also, join conditions are not being pushed down as filters, should we also push those down?

@erizocosmico erizocosmico changed the title sql/(plan,analyzer): implement table pushdown sql/(plan,analyzer): implement pushdown of filters and cols Mar 7, 2018
})

if len(tables) == 1 {
filtersByTable[tables[0]] = append(filtersByTable[tables[0]], expr)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe I don't understand this logic. Does it mean that the expression is only added to the left table?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A filter is only pushed down if only one table is mentioned in the expression (unless we want to change that behavior)

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@erizocosmico
Copy link
Contributor Author

Updated to receive sessions

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
@erizocosmico erizocosmico merged commit 8ac3d7e into src-d:master Mar 12, 2018
@erizocosmico erizocosmico deleted the feature/pushdown-filters branch March 12, 2018 10:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants