Skip to content

Fixes for subquery indexing/correlation tracking #1994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 8, 2023

Conversation

max-hoffman
Copy link
Contributor

I missed a place where we were using getField indexes to do a correlation check. This adds the changes necessary to replace that check with one that uses a subquery's tracked correlation column set. This also adds an expression id column to GetField expression that preserves the id tracking information between iterative passes of the analyzer. It would probably be preferable to avoid all cases where we unnecessarily re-run rules, but this is more near at hand.

@max-hoffman max-hoffman requested a review from fulghum September 8, 2023 19:55
Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Nice! Awesome to see all those IndexedTableAccess nodes come back 😄

@@ -92,9 +93,13 @@ func (s *Scope) NewScope(node sql.Node) *Scope {

// NewScopeFromSubqueryExpression returns a new subscope created from a subquery expression contained by the specified
// node.
func (s *Scope) NewScopeFromSubqueryExpression(node sql.Node) *Scope {
func (s *Scope) NewScopeFromSubqueryExpression(node sql.Node, corr sql.ColSet) *Scope {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be helpful to update the method doc to mention the corr parameter and explain what it means here. It's probably painfully obvious to you of course, but a little documentation there would help other people from having to reverse engineer it when they see this code for the first time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added some attribute docs for what it means, and doc comment here to indicate why it needs to be explicit for subquery expressions

@max-hoffman max-hoffman merged commit a31d047 into max/prog-delete-fixidx Sep 8, 2023
max-hoffman added a commit that referenced this pull request Sep 8, 2023
* fixidx refactors, remove from pushdown

* [ga-format-pr] Run ./format_repo.sh to fix formatting

* Fixes for subquery indexing/correlation tracking (#1994)

* Fixes for subquery indexing/correlation tracking

* Update sql/planbuilder/scope.go

Co-authored-by: Jason Fulghum <[email protected]>

* jason's comments

---------

Co-authored-by: Jason Fulghum <[email protected]>

---------

Co-authored-by: max-hoffman <[email protected]>
Co-authored-by: Jason Fulghum <[email protected]>
@Hydrocharged Hydrocharged deleted the max/subquery-indexing-bugs branch February 7, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants