Skip to content
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

fix regression in the use of name in ProjectionPushdown #8219

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Nov 15, 2023

Which issue does this PR close?

Resolves #8223

Rationale for this change

We found a bug while upgrading IOx to use the latest datafusion

Some of our queries began failing like this:

"Optimizer rule 'push_down_projection' failed"

The regression was introduced in #7981 and is related to columns with periods in their names

What changes are included in this PR?

  1. Back out an unecessary change from Implement DISTINCT ON from Postgres #7981
  2. Add test coverage

Are these changes tested?

yes

Are there any user-facing changes?

bug fix

@github-actions github-actions bot added optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt) labels Nov 15, 2023
@github-actions github-actions bot removed the sqllogictest SQL Logic Tests (.slt) label Nov 15, 2023
@alamb alamb marked this pull request as ready for review November 15, 2023 21:18
@alamb
Copy link
Contributor Author

alamb commented Nov 15, 2023

FYI @gruuya

@@ -228,7 +228,7 @@ impl OptimizerRule for PushDownProjection {
// Gather all columns needed for expressions in this Aggregate
let mut new_aggr_expr = vec![];
for e in agg.aggr_expr.iter() {
let column = Column::from(e.display_name()?);
let column = Column::from_name(e.display_name()?);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was done in #7981 -- it doesn't seem necessary and I think was just a mistake (and did not have adequate test coverage)

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for resolving this; this was a leftover from my initial attempt to address the qualified alias problem (without altering the Expr::Alias enum) that I forgot to rollback.

Copy link
Contributor Author

@alamb alamb Nov 17, 2023

Choose a reason for hiding this comment

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

No problem. The real problem is that we had no test coverage for it :(

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm,
from
from_name
from_qualified_name
might be confusing, we may want to have better naming?

@alamb
Copy link
Contributor Author

alamb commented Nov 15, 2023

might be confusing, we may want to have better naming?

It is very confusing and results in subtle bugs. I'll see if I can find some way to make it better as a follow on PR

@alamb
Copy link
Contributor Author

alamb commented Nov 15, 2023

Thank you for the quick review @comphead

@alamb alamb merged commit 04c77ca into apache:main Nov 15, 2023
23 checks passed
@alamb alamb deleted the alamb/fix_column branch November 15, 2023 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules
Projects
None yet
3 participants