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

Push down aggregation through filter into table scan #4113

Closed
findepi opened this issue Jun 20, 2020 · 1 comment
Closed

Push down aggregation through filter into table scan #4113

findepi opened this issue Jun 20, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@findepi
Copy link
Member

findepi commented Jun 20, 2020

Consider query

SELECT count(*)
FROM sales
WHERE account = 'Important customer'
GROUP BY account

which will be planned as:

- Aggregation: count(*)
  - Filter: account = 'Important customer'
    - TableScan

The ideal connector behavior will be to

  • accept filter in ConnectorMetadata#applyFilter
  • Filter is removed from the plan
  • accept aggregation in ConnectorMetadata#applyAggregation

However, for some connectors this will be hard to achieve.
For example, for a database doing case insensitive comparisons, we may need to
retain Filter on the Presto side.
In such a case, we could attempt ConnectorMetadata#applyAggregation "through Filter"
leveraging the fact that the filter is on the aggregation keys.

(Thanks @sopel39 for spotting this!)

Relates to: #4137

@findepi
Copy link
Member Author

findepi commented Feb 22, 2021

For example, for a database doing case insensitive comparisons, we may need to
retain Filter on the Presto side.
In such a case, we could attempt ConnectorMetadata#applyAggregation "through Filter"
leveraging the fact that the filter is on the aggregation keys.

In such a case, pushing down aggregation would not be correct.

@findepi findepi closed this as completed Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant