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: Remove Unrelated Fields When Expanding Wildcards in Functional Dependency Projections #12060

Merged
merged 4 commits into from
Aug 19, 2024

Conversation

berkaysynnada
Copy link
Contributor

Which issue does this PR close?

Closes #12054.

Rationale for this change

Our downstream tests started failing after #11681. In calc_func_dependencies_for_project(), the projection length is no longer taken from the expression length. Instead, wildcard expressions are now counted based on the number of fields in the wildcard schema. The problem occurs when the wildcard expression has a table reference, but the wildcard schema is built on multiple tables.

What changes are included in this PR?

This PR filters the wildcard schema according to the table reference of the wildcard expression.

Are these changes tested?

Yes, a minimal example of our failing test has been added to joins.slt.

Are there any user-facing changes?

Copy link
Contributor

@ozankabak ozankabak left a comment

Choose a reason for hiding this comment

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

Minor style suggestion, otherwise LGTM

Co-authored-by: Mehmet Ozan Kabak <ozankabak@gmail.com>
@github-actions github-actions bot added logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt) labels Aug 19, 2024
Copy link
Contributor

@goldmedal goldmedal left a comment

Choose a reason for hiding this comment

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

Thank @berkaysynnada for fixing this. LGTM. Just one minor comment.
I'm sorry for missing this case 😭

);

statement ok
CREATE TABLE exchange_rates (
Copy link
Contributor

Choose a reason for hiding this comment

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

How about dorp sales_global and exchange_rates after the test?

@ozankabak
Copy link
Contributor

Thank you @goldmedal for reviewing

@ozankabak ozankabak merged commit c60b798 into apache:main Aug 19, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in Functional Dependency Calculation for Projection
3 participants