Skip to content

Fix "Projection references non-aggregate values" by updating rebase_expr to use transform_down - #8890

Merged
alamb merged 2 commits into
apache:mainfrom
sdf-labs:zhong/fix_rebase_expr
Jan 18, 2024
Merged

alamb merged 2 commits into
apache:mainfrom
sdf-labs:zhong/fix_rebase_expr

Conversation

@wizardxz

@wizardxz wizardxz commented Jan 17, 2024 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #8280
Closes #8898

Rationale for this change

rebase_expr should strive to re-base on the outermost available base expression in order to minimize (however negligible) the computation that needs to be done on top of it.

What changes are included in this PR?

rebase_expr()

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions Bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels Jan 17, 2024
@alamb alamb changed the title Zhong/fix rebase expr Improve performance for rebase_expr by using transform_up Jan 17, 2024
@alamb alamb changed the title Improve performance for rebase_expr by using transform_up Improve performance for rebase_expr by using transform_down Jan 17, 2024
@wizardxz

Copy link
Copy Markdown
Contributor Author

@alamb This is not just performance, but also correctness, see my comment in #8280 (comment)

@alamb

alamb commented Jan 17, 2024

Copy link
Copy Markdown
Contributor

@alamb This is not just performance, but also correctness, see my comment in #8280 (comment)

Thanks @wizardxz -- I have updated the PR title and also made #8898 so it was clearer that this is correctness as well

@alamb alamb changed the title Improve performance for rebase_expr by using transform_down Fix "Projection references non-aggregate values" by updating rebase_expr to use transform_down Jan 17, 2024

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense to me -- thank you @wizardxz

cc @gruuya

@alamb
alamb merged commit d14f766 into apache:main Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error during planning: Projection references non-aggregate values rebase_expr should probably use transform_down and not transform_up

2 participants