prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.97k stars 5.35k forks source link

Collapse series of cross joins with no filters into a single cross join #23122

Open kaikalur opened 3 months ago

kaikalur commented 3 months ago

We have queries that look like:

SELECT ... FROM T1 CROSS JOIN T2 CROSS JOIN T3 ..

That produce faithfull 2 cross joins but if you do:

SELECT .. FROM T1 CROSS JOIN (T2 CROSS JOIN T3) ..

we have only single cross join operator, since there is no filter this should be better

kaikalur commented 3 months ago

CC: @feilong-liu