Skip to content

Conversation

bvolpato-dd
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Recent validations added at #15334 started to cause problems for some LEFT JOIN queries that don't have conditions, for example:

SELECT a, (SELECT MAX(b) FROM data2) as max_b FROM data

This query gets optimized as a left join without conditions.

This basically follows the same approach from #15334 :

vec![Expr::Literal(ScalarValue::Boolean(Some(true)), None)],

What changes are included in this PR?

For joins without conditions, use cross_join if inner, otherwise use a filter with Boolean(true)

Are these changes tested?

Added a roundtrip test case.

Are there any user-facing changes?

n/a

@github-actions github-actions bot added the substrait Changes to the substrait crate label Oct 15, 2025
@bvolpato-dd
Copy link
Contributor Author

Sorry for the mess, opened with a different account by mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[substrait] Scalar subquery in select not supported

1 participant