ashish-kumar-sharma commented on a change in pull request #1419:
URL: https://github.com/apache/hive/pull/1419#discussion_r487366939



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplDumpTask.java
##########
@@ -1155,22 +1150,19 @@ void dumpConstraintMetadata(String dbName, String 
tblName, Path dbRoot, Hive hiv
       Path constraintsRoot = new Path(dbRoot, 
ReplUtils.CONSTRAINTS_ROOT_DIR_NAME);
       Path commonConstraintsFile = new Path(constraintsRoot, 
ConstraintFileType.COMMON.getPrefix() + tblName);
       Path fkConstraintsFile = new Path(constraintsRoot, 
ConstraintFileType.FOREIGNKEY.getPrefix() + tblName);
-      List<SQLPrimaryKey> pks = hiveDb.getPrimaryKeyList(dbName, tblName);
-      List<SQLForeignKey> fks = hiveDb.getForeignKeyList(dbName, tblName);
-      List<SQLUniqueConstraint> uks = hiveDb.getUniqueConstraintList(dbName, 
tblName);
-      List<SQLNotNullConstraint> nns = hiveDb.getNotNullConstraintList(dbName, 
tblName);
-      if ((pks != null && !pks.isEmpty()) || (uks != null && !uks.isEmpty())
-          || (nns != null && !nns.isEmpty())) {
+      SQLAllTableConstraints tableConstraints = 
hiveDb.getTableConstraints(dbName,tblName);
+      if ((tableConstraints.getPrimaryKeys() != null && 
!tableConstraints.getPrimaryKeys().isEmpty()) || 
(tableConstraints.getUniqueConstraints() != null && 
!tableConstraints.getUniqueConstraints().isEmpty())

Review comment:
       Yes, code is very redundant. I have replaced it with 
CollectionsUtils.isNotEmpty() which does the same check i.e not null and 
isEmpty()




----------------------------------------------------------------
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]

Reply via email to