Skip to content

[MINOR] Assert can be replaced in AbstractMaterializedViewRule#perform()#3259

Merged
JiajunBernoulli merged 1 commit intoapache:mainfrom
JiajunBernoulli:opt-mv-doc
Jun 29, 2023
Merged

[MINOR] Assert can be replaced in AbstractMaterializedViewRule#perform()#3259
JiajunBernoulli merged 1 commit intoapache:mainfrom
JiajunBernoulli:opt-mv-doc

Conversation

@JiajunBernoulli
Copy link
Copy Markdown
Contributor

@JiajunBernoulli JiajunBernoulli commented Jun 11, 2023

  1. If maybe better than assert
  • old
assert !compensationColumnsEquiPred.isAlwaysTrue()
                || !otherCompensationPred.isAlwaysTrue()
  • new
 if (compensationColumnsEquiPred.isAlwaysTrue()
        && otherCompensationPred.isAlwaysTrue()) {
      continue;
    }
  1. Optimize code comments
  • Old code comments can cause misunderstandings.
grep -n "// [abc]\." MaterializedViewRule.java
385:            // b. Generate union branch (query).
396:            // c. Generate union branch (view).
422:            // a. Compute final compensation predicate.
459:            // b. Generate final rewriting if possible.
  • Here are new comments.
grep -n "// [abcAB]\." MaterializedViewRule.java
368:            // a. Attempt partial rewriting using union operator. This rewriting
387:            // b. Generate union branch (query).
398:            // c. Generate union branch (view).
424:            // A. Compute final compensation predicate.
461:            // B. Generate final rewriting if possible.

@JiajunBernoulli JiajunBernoulli changed the title [Minor] Assert can be replaced in `AbstractMaterializedViewRule#perfo… [Minor] Assert can be replaced in AbstractMaterializedViewRule#perform() Jun 11, 2023
@JiajunBernoulli JiajunBernoulli marked this pull request as draft June 11, 2023 03:33
@JiajunBernoulli JiajunBernoulli marked this pull request as ready for review June 11, 2023 06:25
@JiajunBernoulli JiajunBernoulli changed the title [Minor] Assert can be replaced in AbstractMaterializedViewRule#perform() [MINOR] Assert can be replaced in AbstractMaterializedViewRule#perform() Jun 11, 2023
@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 1 Code Smell

57.1% 57.1% Coverage
0.0% 0.0% Duplication

@JiajunBernoulli JiajunBernoulli added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Jun 24, 2023
@JiajunBernoulli
Copy link
Copy Markdown
Contributor Author

If there are no other suggestions, I will merge it next week.

Copy link
Copy Markdown
Contributor

@liuyongvs liuyongvs left a comment

Choose a reason for hiding this comment

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

LGTM

@JiajunBernoulli JiajunBernoulli merged commit aff0fc9 into apache:main Jun 29, 2023
@zabetak
Copy link
Copy Markdown
Member

zabetak commented Jul 11, 2023

@JiajunBernoulli @liuyongvs Changing the way that production code behaves cannot be considered a minor contribution. This change shouldn't have gone through without a JIRA ticket. Ideally, there should be also test cases validating that we are correctly bailing out according to the new code that was added.

The minor prefix is also misleading for the release manager as well as users reading the release notes. Please keep this in mind for future changes.

See also relevant thread about minor/small contributions: https://lists.apache.org/thread/pljc1vhg6bl400qpjts3obmm9zvo9pt1

@JiajunBernoulli
Copy link
Copy Markdown
Contributor Author

@zabetak Thanks for your message.

I will pay attention to it in the future.

@zabetak
Copy link
Copy Markdown
Member

zabetak commented Jul 11, 2023

No big deal just letting you know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants