Latest Results
feat(plan): TPC-H's subqueries become joins (P2-T071c)
After resolution, a subquery pass rewrites the subquery shapes TPC-H
uses into joins, as Spark's optimizer does:
- a correlated EXISTS / NOT EXISTS conjunct becomes a left semi / anti
join on its correlation;
- IN (subquery) becomes a left semi join; NOT IN becomes a left anti
join with the NULL-aware key (v = c) OR isnull(v = c);
- a correlated scalar subquery over an aggregate, with equality
correlation, becomes a left outer join with the aggregate grouped by
its keys; a count reads 0 where no rows match.
Correlated predicates move up through filters, projections, aliases and
an ORDER BY without a limit (which goes, as in Spark). Inside a
subquery, conjuncts that read the enclosing query stay above the joins
its own subqueries become, so nested subqueries rewrite too; an IN whose
value is a correlated scalar subquery joins that first.
Uncorrelated scalar subqueries and EXISTS stay expressions. A rewritten
side whose attribute ids overlap the other gets a Shift, so ids stay
unique. Outer references resolve in the immediately enclosing query
only, as in Spark 4.2; subqueries are named as Spark names them
(scalarsubquery(..), exists(..), listquery(..)), and grouping keys that
a subquery in HAVING reads are passed through the aggregate. Shapes
beyond these fail with KRISHIV_UNSUPPORTED_FEATURE (general unnesting:
P2-T115). A global ORDER BY's error context starts at ORDER BY.
Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com> Latest Branches
0%
p2a/m7-urust-t093a-explain 0%
0%
p2a/m6-t082a-parquet-commit © 2026 CodSpeed Technology