-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Support CREATE VIEW and CREATE TABLE verification #15195
Conversation
382eee7
to
1fc9474
Compare
3f0ae5d
to
5c375eb
Compare
started reviewing - first 3 commits LGTM |
219e908
to
53f80a8
Compare
protected Optional<String> resolveFailure(Optional<QueryObjectBundle> control, Optional<QueryObjectBundle> test, QueryContext controlQueryContext, Optional<DdlMatchResult> matchResult, Optional<Throwable> throwable) | ||
{ | ||
return Optional.empty(); | ||
} |
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.
Do we not want a failureResolveManager
like DataVerification?
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.
Failure resolver is used to automatically resolve verification failures due to (test / checksum) query failures. For ddl verification, we can start with no auto resolution, and see if we actually see any query failures are actually false alerts.
// Otherwise, do not pre-create temporary view. | ||
try { | ||
CreateView createExistingView = (CreateView) sqlParser.createStatement( | ||
getOnlyElement(prestoAction.execute(new ShowCreate(VIEW, createView.getName()), REWRITE, SHOW_CREATE_VIEW_CONVERTER).getResults()), |
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.
Should we extract this into a method? Feel like it would be easier to follow
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.
This method would only be used once if we extract. I'm changing this to 2 statements - that might help readability.
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.
LGTM
Remove unsupported query types in QueryType. Also, remove QueryType.Category.
Repurpose the class to represent query bundle with any object name, including table name and view name.
If either all the failure resolvers or all the failure resolver factories are disabled, injection error would occurred due to Set<FailureResolver> or Set<FailureResolverFactory> not binded. Also, extract common logic of verification tests into an abstract tests.
If the specified view already exists, create a temporary view to match the existing view. Otherwise, do nothing for setup queries. Rewrite the target view name, and run both control and test queries. Run a SHOW CREATE VIEW query and the returned CREATE VIEW statement needs to match.
Rewrite the target table of the CREATE TABLE statement, run both control and test queries, run SHOW CREATE TABLE query as the check.
@sujay-jain Thanks for reviewing! |
Verify CREATE VIEW
If the specified view already exists, create a temporary view to match
the existing view. Otherwise, do nothing for setup queries. Rewrite the
target view name, and run both control and test queries. Run a SHOW
CREATE VIEW query and the returned CREATE VIEW statement needs to match.
Verify CREATE TABLE
Rewrite the target table of the CREATE TABLE statement, run both
control and test queries, run SHOW CREATE TABLE query as the check.