Skip to content

[CALCITE-5705] Generalize RemoveEmptySingleRule to work with arbitrary relations and pruning configurations#3205

Closed
zabetak wants to merge 1 commit intoapache:mainfrom
zabetak:empty-single-rule-generalization
Closed

[CALCITE-5705] Generalize RemoveEmptySingleRule to work with arbitrary relations and pruning configurations#3205
zabetak wants to merge 1 commit intoapache:mainfrom
zabetak:empty-single-rule-generalization

Conversation

@zabetak
Copy link
Copy Markdown
Member

@zabetak zabetak commented May 16, 2023

  1. Remove cast to SingleRel inside RemoveEmptySingleRule#onMatch to allow the rule to transform arbitrary relations (such as Correlate) to empty.

  2. Change RemoveEmptySingleRule constructor to accept PruneEmptyRule.Config instead of RemoveEmptySingleRuleConfig to be able to instatiate the rule from any kind of pruning configuration that aims to tranform a relation to empty.

  3. Refactor CorrelateLeftEmptyRuleConfig, ZeroMaxRowsRuleConfig and SortFetchZeroRuleConfig to use RemoveEmptySingleRule and remove duplicate code.

…y relations and pruning configurations

1. Remove cast to `SingleRel` inside `RemoveEmptySingleRule#onMatch` to
allow the rule to transform arbitrary relations (such as `Correlate`)
to empty.

2. Change `RemoveEmptySingleRule` constructor to accept
`PruneEmptyRule.Config` instead of `RemoveEmptySingleRuleConfig` to
be able to instatiate the rule from any kind of pruning configuration
that aims to tranform a relation to empty.

3. Refactor `CorrelateLeftEmptyRuleConfig`, `ZeroMaxRowsRuleConfig` and
`SortFetchZeroRuleConfig` to use `RemoveEmptySingleRule` and remove
duplicate code.
@zabetak zabetak force-pushed the empty-single-rule-generalization branch from 9583fda to 66ac266 Compare May 16, 2023 14:31
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@zabetak zabetak closed this in f322898 May 24, 2023
jhugomoore pushed a commit to jhugomoore/calcite-jhugomoore that referenced this pull request Jun 21, 2023
…y relations and pruning configurations

1. Remove cast to `SingleRel` inside `RemoveEmptySingleRule#onMatch` to
allow the rule to transform arbitrary relations (such as `Correlate`)
to empty.

2. Change `RemoveEmptySingleRule` constructor to accept
`PruneEmptyRule.Config` instead of `RemoveEmptySingleRuleConfig` to
be able to instatiate the rule from any kind of pruning configuration
that aims to tranform a relation to empty.

3. Refactor `CorrelateLeftEmptyRuleConfig`, `ZeroMaxRowsRuleConfig` and
`SortFetchZeroRuleConfig` to use `RemoveEmptySingleRule` and remove
duplicate code.

Close apache#3205
jhugomoore pushed a commit to jhugomoore/calcite-jhugomoore that referenced this pull request Jun 22, 2023
…y relations and pruning configurations

1. Remove cast to `SingleRel` inside `RemoveEmptySingleRule#onMatch` to
allow the rule to transform arbitrary relations (such as `Correlate`)
to empty.

2. Change `RemoveEmptySingleRule` constructor to accept
`PruneEmptyRule.Config` instead of `RemoveEmptySingleRuleConfig` to
be able to instatiate the rule from any kind of pruning configuration
that aims to tranform a relation to empty.

3. Refactor `CorrelateLeftEmptyRuleConfig`, `ZeroMaxRowsRuleConfig` and
`SortFetchZeroRuleConfig` to use `RemoveEmptySingleRule` and remove
duplicate code.

Close apache#3205
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.

1 participant