Skip to content

Support RIGHT JOIN and FULL OUTER JOIN in StandardJoin #86

@fupelaqu

Description

@fupelaqu

Problem

StandardJoin.validate() in sql/src/main/scala/app/softnetwork/elastic/sql/query/From.scala currently rejects all join types except InnerJoin and LeftJoin:

override def validate(): Either[String, Unit] = {
  for {
    _ <- joinType match {
      case Some(InnerJoin | LeftJoin) => Right(())
      case None                       => Right(()) // by default INNER JOIN
      case _ => Left(s"Standard JOIN $this requires an INNER (default) or LEFT JOIN type")
    }
    ...
  } yield ()
}

This means RIGHT JOIN and FULL OUTER JOIN are rejected at parse time, even though the downstream engines (DuckDB in federation, Elasticsearch for single-cluster) could support them.

Impact

  • Federation queries using RIGHT JOIN or FULL OUTER JOIN fail with a parser error before reaching the query planner.
  • Users must rewrite RIGHT JOIN as LEFT JOIN with swapped table order, which is unintuitive.

Proposed Fix

Extend StandardJoin.validate() to accept RightJoin and FullJoin (at minimum for federation mode where DuckDB handles the join).

Context

Discovered during Story 3.6 (End-to-End Federation Query Path) adversarial review.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions