Skip to content

Support scalar correlated subqueries in WHERE clause#79600

Merged
KochetovNicolai merged 12 commits intomasterfrom
analyzer-correlated-scalar
May 6, 2025
Merged

Support scalar correlated subqueries in WHERE clause#79600
KochetovNicolai merged 12 commits intomasterfrom
analyzer-correlated-scalar

Conversation

@novikd
Copy link
Copy Markdown
Member

@novikd novikd commented Apr 25, 2025

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Support scalar correlated subqueries in the WHERE clause. Closes #6697.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Apr 25, 2025

Workflow [PR], commit [b67fdae]

@clickhouse-gh clickhouse-gh bot added the pr-improvement Pull request with some product improvements label Apr 25, 2025
@novikd novikd force-pushed the analyzer-correlated-scalar branch from 289906a to 399c9f6 Compare May 2, 2025 08:11
@novikd novikd marked this pull request as ready for review May 2, 2025 08:12
@novikd novikd changed the title [WIP] Supprt scalar correlated subqueries Support scalar correlated subqueries in WHERE clause May 2, 2025
@novikd novikd requested a review from KochetovNicolai May 2, 2025 08:21

void visitImpl(const QueryTreeNodePtr & node)
{
if (node->getNodeType() == QueryTreeNodeType::FUNCTION)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit strange that we traverse scalar correlated subqueries only as a function argument.
E.g. will it work if I write select ... where (correlated sclar subquery)?

Maybe it's just better to allow query/union in needChildVisit.

@KochetovNicolai KochetovNicolai added this pull request to the merge queue May 6, 2025
Merged via the queue into master with commit b7d1a38 May 6, 2025
116 of 121 checks passed
@KochetovNicolai KochetovNicolai deleted the analyzer-correlated-scalar branch May 6, 2025 16:04
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Correlated subqueries

3 participants