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

feat(query): Add rule - Push filter down to aggregate #10240

Merged
merged 3 commits into from
Mar 1, 2023

Conversation

johnhaxx7
Copy link
Contributor

@johnhaxx7 johnhaxx7 commented Feb 27, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Detail is added as comment in rule_push_down_filter_aggregate.rs

Closes #8439

@vercel
Copy link

vercel bot commented Feb 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
databend ⬜️ Ignored (Inspect) Visit Preview Mar 1, 2023 at 5:07AM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Feb 27, 2023
@johnhaxx7 johnhaxx7 force-pushed the push-down-agg branch 3 times, most recently from ccb7d7f to 9d71585 Compare February 27, 2023 04:27
@johnhaxx7 johnhaxx7 marked this pull request as ready for review February 27, 2023 04:47
@johnhaxx7
Copy link
Contributor Author

Hi @sundy-li, @BohuTANG PTAL, thanks!

BTW, I was looking at TiDB for heuristic rules. Seems like we don't have push filter to sort.
https://github.com/datafuselabs/databend/blob/1ae0a3dc06e89890d57de263aded04c230daa8f5/src/query/sql/src/planner/optimizer/rule/rule.rs#L34-L64

I'm not really sure if that's applied to storage layer. The filter in TableScan is empty but I'm not sure can you help confirm?

mysql> explain select a, b from t1 order by a limit 10;
+--------------------------------------------------------+
| explain                                                |
+--------------------------------------------------------+
| Limit                                                  |
| ├── limit: 10                                          |
| ├── offset: 0                                          |
| ├── estimated rows: 0.00                               |
| └── Sort                                               |
|     ├── sort keys: [a ASC NULLS LAST]                  |
|     ├── estimated rows: 0.00                           |
|     └── TableScan                                      |
|         ├── table: default.default.t1                  |
|         ├── read rows: 0                               |
|         ├── read bytes: 0                              |
|         ├── partitions total: 0                        |
|         ├── partitions scanned: 0                      |
|         ├── push downs: [filters: [], limit: 10]       |
|         └── estimated rows: 0.00                       |
+--------------------------------------------------------+

@BohuTANG BohuTANG requested review from sundy-li and leiysky February 27, 2023 05:26
@sundy-li
Copy link
Member

Seems like we don't have push filter to sort

Yes, we can have that.

@BohuTANG
Copy link
Member

BohuTANG commented Mar 1, 2023

@mergify update

@mergify
Copy link
Contributor

mergify bot commented Mar 1, 2023

update

✅ Branch has been successfully updated

@mergify mergify bot merged commit 1530e25 into databendlabs:main Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Push down filter through Aggregate
4 participants