Github user saucam commented on the pull request:
https://github.com/apache/spark/pull/3888#issuecomment-68853317
Hi Michael,
Thanks for the feedback.
1. Yes it does not handle correlated queries. It definitely makes more
sense to convert correlated queries to joins,
but for uncorrelated queries, i think its too slow if table size is large
and user is querying on smaller data:
eg: 2 tables with ~ 45 million rows each ; subquery returns only 90 rows:
select * from Y1 where Y1.id in (select Y2.id from Y2 where Y2.id < 90);
takes about 12 seconds to run by this approach on a single machine
(--executor-memory 16G --driver-memory 8G)
by following the join approach, query is changed to :
select * from Y1 left semi join (select Y2.id as sqc0 from Y2 where id <
90) subquery on Y1.id = subquery.sqc0;
which takes 660 seconds to run on the same machine
2. This approach can handle arbitrary nesting of subqueries :
select * from Y1 where Y1.id in (select Y2.id where Y2.timestamp in (select
Y3.timestamp limit 20))
Can we take some hybrid approach from the two ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]