-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Ensure to pushdown the aggregation for count(const) #4473
Conversation
...tgresql/src/test/java/io/prestosql/plugin/postgresql/TestPostgreSqlIntegrationSmokeTest.java
Outdated
Show resolved
Hide resolved
77baf17
to
aaec9cd
Compare
Thanks for fixing this. |
presto-main/src/main/java/io/prestosql/sql/planner/PlanOptimizers.java
Outdated
Show resolved
Hide resolved
b49104e
to
4f4732f
Compare
Shall we remove the other (late) occurrence of the |
👍 |
Aggregate pushdown should be enabled even with count(const) query. Since SimplifyCountOverConstant is applied after PushAggregationIntoTableScan, the aggregation pushdown does not treat count(*) and count(const) uniformally.
4f4732f
to
d95dbe2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My approval may not mean much :) but LGTM
Merged, thanks! |
Purpose
Aggregate pushdown should be enabled even with count(const) query. Since
SimplifyCountOverConstant
is applied afterPushAggregationIntoTableScan
, the aggregation pushdown does not treat count(*) and count(const) uniformally.The logical plan of the following query with PostgreSQL connector is fixed.
Before
After
The fix eliminates the aggregation node from the Presto side properly.
It fixes #4362