-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[BugFix] Fix full outer join rewrite and nested mv refresh bug for main(#34071) #34299
[BugFix] Fix full outer join rewrite and nested mv refresh bug for main(#34071) #34299
Conversation
} | ||
return Range.all(); | ||
} | ||
|
||
/** | ||
* Return the updated partition key ranges of the specific table. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are my suggestions upon reviewing your code:
-
Error Handling: There's no handling for potential error(s) when parsing the date string, which might throw
DateTimeParseException
. You should handle this exception in order to prevent it from propagating upwards. -
Code Duplication: There is some repetitive code occurring in both
convertToDateRange
andconvertToVarcharRange
. This especially holds true for the conditionals checking whether the range has upper and lower bound (both existing independently). To address this, consider refactoring these sections into their own methods. You can create helper functions to carry out these tasks. -
Type Checks: The instance type checks with
instanceof DateLiteral
orinstanceof StringLiteral
can potentially become problematic if more types are to be supported later on. Consider using a strategy pattern or similar approach for dealing with different types. -
Comments: While you have done well to comment your methods, you could improve readability by also describing what the function does in general, not just talking about specific implementation details. These comments will be beneficial for people reading your code, especially people new to the project.
-
Magic Numbers: The use of
.getKeys().get(0)
suggests there may be magic numbers being used in your code. This might make your code less understandable and difficult to maintain. If the 0 index has a special significance, either comment it well or factor out a constant with an explanatory name. -
Safe Unwrapping: When unpacking values from complex objects like
from.lowerEndpoint().getKeys().get(0)
, there's an assumption that every step retrieves a non-null value. Consider including null-checks or use Optional types to avoid NullPointerExceptions. -
Method Naming: The method names such as
convertToDateRange
andconvertToVarcharRange
are good and descriptive. Good job on this!
Overall your code seems well-structured, other than these few areas that could be enhanced.
75ab92a
to
1fbe6eb
Compare
...-core/src/main/java/com/starrocks/sql/optimizer/rewrite/scalar/MvNormalizePredicateRule.java
Outdated
Show resolved
Hide resolved
...om/starrocks/sql/optimizer/rule/transformation/materialization/MaterializedViewRewriter.java
Outdated
Show resolved
Hide resolved
fe/fe-core/src/test/java/com/starrocks/planner/MaterializedViewTest.java
Outdated
Show resolved
Hide resolved
92e6129
to
6921179
Compare
…ocks#34071) For rewrite: 1. fix join derivibility rewrite bug for multi joins query 2. fix equivalence class construction bugs to exclude outer join on predicate, which should be rewritten by ReplaceColumnRefRewriter 3. optimize predicate normalization to process column name's case 4. set mv plan timeout to new_planner_optimize_timeout For refresh: 1. fix refresh on nested mv bug to process date format like %Y%m%d 2. set strict mode to false for mv refresh Signed-off-by: ABingHuang <codekhuang@163.com>
6921179
to
df381aa
Compare
Kudos, SonarCloud Quality Gate passed!
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 148 / 153 (96.73%) file detail
|
For rewrite:
For refresh:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: