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

Update QualifiedName to Store the Case-sensitive QualifiedName as well #359

Merged
merged 1 commit into from
Aug 2, 2019

Conversation

raveeram
Copy link
Contributor

@raveeram raveeram commented Aug 1, 2019

  • Some Data-sources (like Cassandra) have case-sensitive database and table names. Preserve the casing so the corresponding Connector can use the right case-sensitive QualifiedName when needed.

@raveeram raveeram changed the title Update QualifiedName to Store the Case-sensitive QualifiedName too Update QualifiedName to Store the Case-sensitive QualifiedName as well Aug 1, 2019
@@ -291,6 +298,47 @@ public static QualifiedName ofTable(
return new QualifiedName(catalogName, databaseName, tableName, null, null);
}

private static QualifiedName createCaseSensitiveQualifiedNameIfNecessary(
@NonNull final String catalogName,
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 have the full context, but I would create a separate function with the non-standardlized qualifiedname as the single input, then it returns the standard qualifiedName as one object. We can also create a new class as the standizedQualified name (which exends the current one) to handle the format and related operations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, but the expectation is that this is a one-off requirement and I wanted to avoid having to refactor all the QualifiedName constructors in the Controller/Service code to call a new API or a new QualifiedName type. This way, the change is contained inside the QualifiedName itself and the Connector makes a decision on whether to use the case-sensitive version or not.

@@ -49,6 +49,9 @@
private Map<String, String> parts;
private Type type;

// Null if this QualifiedName was all lower-case to begin with.
private QualifiedName caseSensitiveQualifiedName;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the rationale of not using Optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Optional is not serializable and also seems to be a general recommendation that Optional should be used in return values and not for class attributes: https://stackoverflow.com/questions/29033518/is-it-a-good-practice-to-use-optional-as-an-attribute-in-a-class

@NonNull final String standardPartitionName,
@NonNull final String viewName,
@NonNull final String standardViewName) {
return (!databaseName.isEmpty() && !standardDatabaseName.equals(databaseName))
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the isEmpty check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah not anymore, was using the NonStandardized string earlier. Removed.

@ajoymajumdar ajoymajumdar merged commit e5e69f5 into Netflix:master Aug 2, 2019
ajoymajumdar added a commit to ajoymajumdar/metacat that referenced this pull request Aug 12, 2019
zhljen pushed a commit to zhljen/metacat that referenced this pull request Nov 13, 2019
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.

None yet

3 participants