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

Multiple PushAggregationThroughOuterJoin issues #10724

Closed
sopel39 opened this issue May 29, 2018 · 9 comments
Closed

Multiple PushAggregationThroughOuterJoin issues #10724

sopel39 opened this issue May 29, 2018 · 9 comments
Assignees

Comments

@sopel39
Copy link
Contributor

sopel39 commented May 29, 2018

Query:

presto> explain select x, max(x) from (select * from (values (1)) t(x) left join (values (1)) t2(y) on t.x = t2.y) group by x;
Query is gone (server restarted?)

java.lang.IllegalStateException: Cannot resolve symbol field
	at com.google.common.base.Preconditions.checkState(Preconditions.java:585)
	at com.facebook.presto.sql.planner.ExpressionSymbolInliner$Visitor.rewriteSymbolReference(ExpressionSymbolInliner.java:68)
	at com.facebook.presto.sql.planner.ExpressionSymbolInliner$Visitor.rewriteSymbolReference(ExpressionSymbolInliner.java:55)

Diagnosis: PushAggregationThroughOuterJoin should verify that aggregations don't contain probe symbols

With optimization:

presto> select x, count(*) from (select * from (values (1)) t(x) left join (select * from (values (1)) t2(y) where false) t2(y) on true) group by x;
 x | _col1
---+-------
 1 |     0
(1 row)

without:

presto> set session push_aggregation_through_join=false;
SET SESSION
presto> select x, count(*) from (select * from (values (1)) t(x) left join (select * from (values (1)) t2(y) where false) t2(y) on true) group by x;
 x | _col1
---+-------
 1 |     1
(1 row)

Diagnosis: PushAggregationThroughOuterJoin shouldn't fire if default aggregation would be pushed to build side

CC: @rschlussel2

@atris
Copy link

atris commented Jun 5, 2018

@sopel39 Is this issue still applicable?

@sopel39
Copy link
Contributor Author

sopel39 commented Jun 5, 2018

@atris yes

@atris
Copy link

atris commented Jun 5, 2018 via email

@findepi
Copy link
Contributor

findepi commented Jun 5, 2018

@atris we're agile, there is not need for formal assignment. Just ping here that you're working on this (you kinda already did) and go for it!

@atris
Copy link

atris commented Jun 6, 2018

Ack, thanks

@atris
Copy link

atris commented Jul 10, 2018

@findepi @sopel39 For the second part, will not pushing down aggregation when the join is a Left join be the best way to solve the bug? I could not see any regressions in the approach, but wanted to double check with you guys

@sopel39
Copy link
Contributor Author

sopel39 commented Jul 10, 2018

The second part only relates to default aggregations pushdown. The rule shouldn't fire If aggregation was non-default (e.g: all grouping sets are non-empty) and would become default when pushed down.

@atris
Copy link

atris commented Jul 10, 2018

@sopel39 When you say default aggregations, do you mean aggregations with default values?

@sopel39
Copy link
Contributor Author

sopel39 commented Jul 10, 2018

@atris

I mean aggregations like

select sum(column) from table

, e.g: aggregations with empty group by section. Those produce value even if there are not rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants