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

Avoid firing RemoveRedundantTableScanPredicate when there is no TableScan predicate #10549

Closed
wants to merge 1 commit into from

Conversation

martint
Copy link
Member

@martint martint commented Jan 11, 2022

Partially mitigates #10532

@cla-bot cla-bot bot added the cla-signed label Jan 11, 2022
Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

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

Partially mitigates #10532

Which connectors it will be sufficient for?
I.e. will it help in real life, or only make testing harder?

Perhaps, instead of this, normalize expression before returning it from RemoveRedundantTableScanPredicate?

@@ -57,7 +57,7 @@

private static final Pattern<FilterNode> PATTERN =
filter().with(source().matching(
tableScan().capturedAs(TABLE_SCAN)));
tableScan().capturedAs(TABLE_SCAN).matching(node -> !node.getEnforcedConstraint().isAll())));
Copy link
Member

Choose a reason for hiding this comment

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

The rule code below doesn't make it obvious that this is a special case..
Maybe rename the rule to RemoveRedundantPredicateAboveTableScan

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. The name of the rule confused me when I started looking at it.

@@ -57,7 +57,7 @@

private static final Pattern<FilterNode> PATTERN =
filter().with(source().matching(
tableScan().capturedAs(TABLE_SCAN)));
tableScan().capturedAs(TABLE_SCAN).matching(node -> !node.getEnforcedConstraint().isAll())));
Copy link
Member

Choose a reason for hiding this comment

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

The rule code below doesn't make it obvious that this is a special case..
Maybe rename the rule to RemoveRedundantPredicateAboveTableScan

@martint
Copy link
Member Author

martint commented Jan 13, 2022

Which connectors it will be sufficient for? I.e. will it help in real life, or only make testing harder?

All connectors, especially when the filter contains expressions like the one above -- it's actually independent of connector implementation. It's a bug in how the RemoveRedundantTableScanPredicate rule is manipulating the filter predicate.

Regardless, the rule shouldn't fire when there's no work to do, which is what I'm adding here.

@sopel39
Copy link
Member

sopel39 commented Feb 8, 2022

I've made PR that fixes this holistically: #10985

@martint
Copy link
Member Author

martint commented Mar 3, 2022

Folded into #10985

@martint martint closed this Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants