Skip to content

Add support for non-column key for equijoin when eliminating cross join to inner join  #4442

@ygf11

Description

@ygf11

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Currently datafusion support to rewrite cross join to inner join. For example:

select * from test0 as t0 cross join test1 as t1 where t0.a = t1.a;
select * from test0 as t0 cross join test1 as t1 where t0.b = t1.b;
...

But only when the join keys are column, so the following sql will not rewrite to inner join.

select * from test0 as t0 cross join test1 as t1 where t0.a + 1 = t1.a * 2;
select * from test0 as t0 cross join test1 as t1 where t0.a * 2 = t1.a - 1;
...

Describe the solution you'd like
Add support for non-column key for equijoin when eliminating cross join to inner join

Describe alternatives you've considered

Additional context

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