ashish-kumar-sharma commented on a change in pull request #2211:
URL: https://github.com/apache/hive/pull/2211#discussion_r626396870
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##########
@@ -2584,57 +2584,89 @@ long getPartsFound() {
}
@Override
+ @Deprecated
public List<SQLPrimaryKey> getPrimaryKeys(String catName, String dbName,
String tblName) throws MetaException {
- catName = StringUtils.normalizeIdentifier(catName);
- dbName = StringUtils.normalizeIdentifier(dbName);
- tblName = StringUtils.normalizeIdentifier(tblName);
+ PrimaryKeysRequest request = new PrimaryKeysRequest(dbName, tblName);
+ request.setCatName(catName);
+ return getPrimaryKeys(request);
+ }
+
+ @Override
+ public List<SQLPrimaryKey> getPrimaryKeys(PrimaryKeysRequest request) throws
MetaException {
+ String catName = StringUtils.normalizeIdentifier(request.getCatName());
+ String dbName = StringUtils.normalizeIdentifier(request.getDb_name());
+ String tblName = StringUtils.normalizeIdentifier(request.getTbl_name());
if (shouldGetConstraintFromRawStore(catName, dbName, tblName)) {
- return rawStore.getPrimaryKeys(catName, dbName, tblName);
+ return rawStore.getPrimaryKeys(request);
}
return sharedCache.listCachedPrimaryKeys(catName, dbName, tblName);
}
@Override
+ @Deprecated
public List<SQLForeignKey> getForeignKeys(String catName, String
parentDbName, String parentTblName,
String foreignDbName, String foreignTblName) throws MetaException {
+ ForeignKeysRequest request = new ForeignKeysRequest(parentDbName,
parentTblName, foreignDbName, foreignTblName);
+ request.setCatName(catName);
+ return getForeignKeys(request);
+ }
+
+ @Override
+ public List<SQLForeignKey> getForeignKeys(ForeignKeysRequest request) throws
MetaException {
// Get correct ForeignDBName and TableName
- if (StringUtils.isEmpty(foreignDbName) ||
StringUtils.isEmpty(foreignTblName) || StringUtils.isEmpty(parentDbName)
- || StringUtils.isEmpty(parentTblName)) {
- return rawStore.getForeignKeys(catName, parentDbName, parentTblName,
foreignDbName, foreignTblName);
+ if (StringUtils.isEmpty(request.getParent_db_name()) ||
StringUtils.isEmpty(request.getParent_tbl_name())
+ || StringUtils.isEmpty(request.getForeign_db_name()) ||
StringUtils.isEmpty(request.getForeign_tbl_name())) {
+ return rawStore.getForeignKeys(request);
}
- catName = StringUtils.normalizeIdentifier(catName);
- foreignDbName = StringUtils.normalizeIdentifier(foreignDbName);
- foreignTblName = StringUtils.normalizeIdentifier(foreignTblName);
- parentDbName = StringUtils.isEmpty(parentDbName) ? "" :
normalizeIdentifier(parentDbName);
- parentTblName = StringUtils.isEmpty(parentTblName) ? "" :
StringUtils.normalizeIdentifier(parentTblName);
+ String catName = StringUtils.normalizeIdentifier(request.getCatName());
+ String foreignDbName =
StringUtils.normalizeIdentifier(request.getForeign_db_name());
+ String foreignTblName =
StringUtils.normalizeIdentifier(request.getForeign_tbl_name());
+ String parentDbName =
+ StringUtils.isEmpty(request.getParent_db_name()) ? "" :
normalizeIdentifier(request.getParent_db_name());
+ String parentTblName = StringUtils.isEmpty(request.getParent_tbl_name()) ?
"" : StringUtils
+ .normalizeIdentifier(request.getParent_tbl_name());
if (shouldGetConstraintFromRawStore(catName, foreignDbName,
foreignTblName)) {
- return rawStore.getForeignKeys(catName, parentDbName, parentTblName,
foreignDbName, foreignTblName);
+ return rawStore.getForeignKeys(request);
}
return sharedCache.listCachedForeignKeys(catName, foreignDbName,
foreignTblName, parentDbName, parentTblName);
}
@Override
+ @Deprecated
public List<SQLUniqueConstraint> getUniqueConstraints(String catName, String
dbName, String tblName)
throws MetaException {
- catName = StringUtils.normalizeIdentifier(catName);
- dbName = StringUtils.normalizeIdentifier(dbName);
- tblName = StringUtils.normalizeIdentifier(tblName);
+ UniqueConstraintsRequest request = new UniqueConstraintsRequest(catName,
dbName, tblName);
+ return getUniqueConstraints(request);
+ }
+
+ @Override
+ public List<SQLUniqueConstraint>
getUniqueConstraints(UniqueConstraintsRequest request) throws MetaException {
+ String catName = StringUtils.normalizeIdentifier(request.getCatName());
+ String dbName = StringUtils.normalizeIdentifier(request.getDb_name());
+ String tblName = StringUtils.normalizeIdentifier(request.getTbl_name());
if (shouldGetConstraintFromRawStore(catName, dbName, tblName)) {
- return rawStore.getUniqueConstraints(catName, dbName, tblName);
+ return rawStore.getUniqueConstraints(request);
}
return sharedCache.listCachedUniqueConstraint(catName, dbName, tblName);
}
@Override
+ @Deprecated
public List<SQLNotNullConstraint> getNotNullConstraints(String catName,
String dbName, String tblName)
throws MetaException {
- catName = normalizeIdentifier(catName);
- dbName = StringUtils.normalizeIdentifier(dbName);
- tblName = StringUtils.normalizeIdentifier(tblName);
+ NotNullConstraintsRequest request = new NotNullConstraintsRequest(catName,
dbName, tblName);
+ return getNotNullConstraints(request);
+ }
+
+ @Override
+ public List<SQLNotNullConstraint>
getNotNullConstraints(NotNullConstraintsRequest request) throws MetaException {
+ String catName = normalizeIdentifier(request.getCatName());
Review comment:
Because catName will always be present. I have checked all the method
calling this method
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]