Skip to content

Fix the bahavior of expr_is_relevant #58

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

Closed

Conversation

xudong963
Copy link
Contributor

No description provided.

Copy link
Collaborator

@suremarc suremarc left a comment

Choose a reason for hiding this comment

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

I have been thinking about this, it is really unfortunate that some joins will be converted into cross joins. It means we can't efficiently support join filters like this:

SELECT t1.year FROM t1 JOIN t2 ON (
    t1.year BETWEEN t2.year AND t2.year + 5
)

which is a valid and common pattern. Instead with this change, the t2.year BETWEEN t3.year AND t3.year + 5 filter will be marked as irrelevant and the dependency relation will be a cross join, which will make maintenance not incremental at all.

I know we did this to materialize a table at work, but I think I'd rather keep this commit in our fork. The proper way to fix it would be to analyze which columns in the source scans are partition columns (or more generally RowMetadata columns) and traverse the plan bottom-up, marking which columns in the plan can be computed from the row metadata scans.

We can maybe discuss some other possible shorter-term fixes that don't have this problem, perhaps for example we could add another stage to the MV analysis that removes expressions that reference non-row-metadata columns.

@xudong963
Copy link
Contributor Author

Thank you @suremarc , let's close the PR and fix it in a more robust way later

@xudong963 xudong963 closed this May 23, 2025
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