adesh-rao commented on a change in pull request #1109:
URL: https://github.com/apache/hive/pull/1109#discussion_r452779486



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/SharedCache.java
##########
@@ -470,6 +484,107 @@ boolean cachePartitions(Iterable<Partition> parts, 
SharedCache sharedCache, bool
       }
     }
 
+    boolean cachePrimaryKeys(List<SQLPrimaryKey> primaryKeys, boolean 
fromPrewarm) {
+      return cacheConstraints(primaryKeys, fromPrewarm, 
MemberName.PRIMARY_KEY_CACHE);
+    }
+
+    boolean cacheForeignKeys(List<SQLForeignKey> foreignKeys, boolean 
fromPrewarm) {
+      return cacheConstraints(foreignKeys, fromPrewarm, 
MemberName.FOREIGN_KEY_CACHE);
+    }
+
+    boolean cacheUniqueConstraints(List<SQLUniqueConstraint> 
uniqueConstraints, boolean fromPrewarm) {
+      return cacheConstraints(uniqueConstraints, fromPrewarm, 
MemberName.UNIQUE_CONSTRAINT_CACHE);
+    }
+
+    boolean cacheNotNullConstraints(List<SQLNotNullConstraint> 
notNullConstraints, boolean fromPrewarm) {
+      return cacheConstraints(notNullConstraints, fromPrewarm, 
MemberName.NOTNULL_CONSTRAINT_CACHE);
+    }
+
+    // Common method to cache constraints
+    private boolean cacheConstraints(List constraintsList,
+                             boolean fromPrewarm,
+                             MemberName mn) {
+      if (constraintsList == null || constraintsList.isEmpty()) {
+        return true;
+      }
+      try {
+        tableLock.writeLock().lock();
+        final int[] size = {0};

Review comment:
       This is being used inside lambda function. It requires the variable to 
be used as final. Because of this, I can't use int or Integer. So I chose int 
array instead.




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