You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/15 12:01:46 UTC
[GitHub] [arrow-datafusion] Dandandan opened a new issue #566: Common subexpression elimination
Dandandan opened a new issue #566:
URL: https://github.com/apache/arrow-datafusion/issues/566
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
I like to support eliminating common subexpressions from a query plan.
For example, this example from TCP-H query 1:
```sql
select *
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge
from T
```
could be rewritten to reuse the result of `l_extendedprice * (1 - l_discount)` by moving it into another projection.
This looks in SQL as something like:
```sql
with temp as (
select
l_extendedprice * (1 - l_discount) as cs
from t
)
select
sum(cs) as sum_disc_price,
sum(cs * (1 + l_tax)) as sum_charge
from temp
```
**Describe the solution you'd like**
Detect common subexpression in projections / group by, join conditions etc. and remove them by moving doing them once in a projection step. Note: this only makes sense when the expression includes any calculation (e.g. not a column reference with alias).
**Describe alternatives you've considered**
n/a
**Additional context**
n/a
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb closed issue #566: Common subexpression elimination
Posted by GitBox <gi...@apache.org>.
alamb closed issue #566:
URL: https://github.com/apache/arrow-datafusion/issues/566
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org