Does Spark support subqqueries?


This question already has an answer here:


Spark 2.0.0+:

since 2.0.0 Spark supports a full range of subqueries. See Does SparkSQL support subquery? for details.

Spark < 2.0.0

Does Spark support subqqueries?

Generally speaking it does. Constructs like SELECT * FROM (SELECT * FROM foo WHERE bar = 1) as tmp perfectly valid queries in the Spark SQL.

As far as I can tell from the Catalyst parser source it doesn't support inner queries in a NOT IN clause:

| termExpression ~ (NOT ~ IN ~ "(" ~> rep1sep(termExpression, ",")) <~ ")" ^^ {
    case e1 ~ e2 => Not(In(e1, e2))

It is still possible to use outer join followed by filter to obtain the same effect.

Need Your Help

Does using the TOP X * format in SQL speed up queries significantly?

sql sql-server-2008 query-optimization

So lately when I run queries on huge tables I'll use the the top 10 * notation like so:

Get class with jQuery


Im able to get id, src, style or whatever with: