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

skip presto view parsing #211

Merged
merged 7 commits into from
Mar 4, 2021
Merged

skip presto view parsing #211

merged 7 commits into from
Mar 4, 2021

Conversation

patduin
Copy link
Contributor

@patduin patduin commented Mar 4, 2021

No description provided.

@patduin patduin requested a review from a team March 4, 2021 14:23
CHANGELOG.md Outdated Show resolved Hide resolved
String databaseName = metaStoreMapping.transformOutboundDatabaseName(originalDatabaseName);
table.setDbName(databaseName);
if (databaseName.equalsIgnoreCase(originalDatabaseName)) {
// Skip all the view parsing if nothing is going to change, the parsing is not without problems and we can't catch
Copy link
Contributor

Choose a reason for hiding this comment

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

is it worth keeping the code on line 123 since that will throw an error still?

Copy link
Contributor

Choose a reason for hiding this comment

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

the original can't have the same string as the extended cause it also needs the colon. if we add it will it still throw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I return the table in this if so we'll not even try to parse.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, but if the database name is different it will still throw an error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No because I skip parsing in the parser class for Presto markers. The if in here is to ensure other crazy markers don't also through errors. The code here is to basically get back to same support as in pre WD 3.6.0. WD 3.7.0 introduced the problems.
If we really have to support Presto I got this follow up: #212

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, thanks for creating that issue. So for now we'll return the Presto view "as is" but that could mean it won't actually work since it doesn't have the correct prefixes and that's what #212 is all about.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct this is fixing and reverting old behaviour. Make it work again if there are no prefixes to remove.

String originalDatabaseName = table.getDbName();
String databaseName = metaStoreMapping.transformOutboundDatabaseName(originalDatabaseName);
table.setDbName(databaseName);
if (databaseName.equalsIgnoreCase(originalDatabaseName)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand what's going on here - why is the db name the same in this case?

Copy link
Contributor Author

@patduin patduin Mar 4, 2021

Choose a reason for hiding this comment

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

I don't know if it is that's true that's why I'm checking:
if our transform didn't change the database name we don't need to try and do the parsing just return the table as is (nothing would have changed).

This creeped in when we removed the IdentityMapping (which was just returning table for non prefixed metastores). So the if will mimic that behaviour again.

Patrick Duin and others added 4 commits March 4, 2021 15:53
…ping/model/ASTQueryMapping.java

Co-authored-by: Andreea Paduraru <40387422+andreeapad@users.noreply.github.com>
Co-authored-by: Andreea Paduraru <40387422+andreeapad@users.noreply.github.com>
…ping/model/ASTQueryMappingTest.java

Co-authored-by: Adrian Woodhead <awoodhead@expediagroup.com>
…ping/model/ASTQueryMappingTest.java

Co-authored-by: Adrian Woodhead <awoodhead@expediagroup.com>
@@ -56,6 +61,13 @@ public String transformOutboundDatabaseName(MetaStoreMapping metaStoreMapping, S
return result.toString();
}

boolean hasMarker(String query) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The function name hasMarker isn't super descriptive. Can we change it to something like hasIncompatibleViewMarker, or hasPrestoViewMarker, or hasNonHiveViewMarker, or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure I like hasNonHiveViewMarker

@andreeapad andreeapad merged commit 20f4e44 into main Mar 4, 2021
@andreeapad andreeapad deleted the fix/presto-view-errors branch March 4, 2021 17:50
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.

4 participants