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

Add personalized configuration parameters for each metastore. #315

Merged
merged 14 commits into from
May 27, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public abstract class AbstractMetaStore {
private transient @JsonProperty @NotNull MetaStoreStatus status = MetaStoreStatus.UNKNOWN;
private long latency = 0;
private transient @JsonIgnore HashBiMap<String, String> databaseNameBiMapping = HashBiMap.create();
private Map<String, String> configurationProperties = Collections.emptyMap();

public AbstractMetaStore(String name, String remoteMetaStoreUris, AccessControlType accessControlType) {
this.name = name;
Expand Down Expand Up @@ -243,4 +244,12 @@ public String toString() {
.toString();
}

public Map<String, String> getConfigurationProperties() {

Choose a reason for hiding this comment

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

Please move these two methods below the setDatabaseNameMapping method to keep them in sync with the property definitions. Normally, toString (if defined) is the last method in a class.

return configurationProperties;
}

public void setConfigurationProperties(
Map<String, String> configurationProperties) {
this.configurationProperties = configurationProperties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public CloseableThriftHiveMetastoreIface newInstance(AbstractMetaStore metaStore
if (waggleDanceConfiguration.getConfigurationProperties() != null) {
properties.putAll(waggleDanceConfiguration.getConfigurationProperties());
}
//override per metastore

Choose a reason for hiding this comment

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

The comment isn't needed.
nit: there's a space missing between if and (. You might also want to leave an empty line before the return statement to improve readability.

properties.putAll(metaStore.getConfigurationProperties());
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a junit test please?

Copy link
Author

Choose a reason for hiding this comment

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

added

return newHiveInstance(metaStore, properties);
}

Expand Down