Skip to content

Feature request: Support for lateral joins #10048

@simonvandel

Description

@simonvandel

Is your feature request related to a problem or challenge?

Here is DuckDB's documentation.

The first example given in the above DuckDB documentation is

SELECT *
FROM range(3) t(i), LATERAL (SELECT i + 1) t2(j);

Which gives

i j
0 1
2 3
1 2

If I try the same in datafusion-cli 37.0:

SELECT * FROM unnest(range(3)) t(i), LATERAL (SELECT i + 1) t2(j);

(Note that I had to wrap range(3) in a unnest, as Datafusion does not yet have a range table function.)

This gives
Schema error: No field named i.

I would have expected that Datafusion would let (SELECT i + 1) t2(j) refer to i from the first table.

Describe the solution you'd like

Support for lateral joins.

DuckDB mentions that the LATERAL keyword is optional.
The first implementation in Datafusion would not need this.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions