[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504248&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504248
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 16:52
Start Date: 23/Oct/20 16:52
Worklog Time Spent: 10m 
  Work Description: ashish-kumar-sharma commented on a change in pull 
request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r511014101



##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##
@@ -2846,31 +2846,28 @@ public SQLAllTableConstraints 
getAllTableConstraints(String catName, String dbNa
 return sqlAllTableConstraints;
   }
 
-  @Override public List createTableWithConstraints(Table tbl, 
List primaryKeys,
-  List foreignKeys, List 
uniqueConstraints,
-  List notNullConstraints, 
List defaultConstraints,
-  List checkConstraints) throws 
InvalidObjectException, MetaException {
-List constraintNames = rawStore
-.createTableWithConstraints(tbl, primaryKeys, foreignKeys, 
uniqueConstraints, notNullConstraints,
-defaultConstraints, checkConstraints);
+  @Override public SQLAllTableConstraints createTableWithConstraints(Table 
tbl, SQLAllTableConstraints constraints) throws InvalidObjectException, 
MetaException {

Review comment:
   done





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 504248)
Time Spent: 1h 10m  (was: 1h)

> [CachedStore] Data miss match between cachedstore and rawstore
> --
>
> Key: HIVE-24258
> URL: https://issues.apache.org/jira/browse/HIVE-24258
> Project: Hive
>  Issue Type: Improvement
>Reporter: Ashish Sharma
>Assignee: Sankar Hariappan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Description
> Objects like table name, db name, column name etc are case insensitive as per 
> HIVE contract but standalone metastore cachedstore is case sensitive.  As 
> result of which there is mismatch in rawstore output and cachedstore output.
> Example - 
> expected:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]> 
> but was:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:Pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504229&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504229
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 16:14
Start Date: 23/Oct/20 16:14
Worklog Time Spent: 10m 
  Work Description: ashish-kumar-sharma commented on a change in pull 
request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r510993015



##
File path: 
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStore.java
##
@@ -1568,12 +1568,7 @@ public void testPrimaryKeys() {
 List cachedKeys = sharedCache.listCachedPrimaryKeys(
 DEFAULT_CATALOG_NAME, tbl.getDbName(), tbl.getTableName());
 
-Assert.assertEquals(cachedKeys.size(), 1);
-Assert.assertEquals(cachedKeys.get(0).getPk_name(), "pk1");
-Assert.assertEquals(cachedKeys.get(0).getTable_db(), "db");
-Assert.assertEquals(cachedKeys.get(0).getTable_name(), tbl.getTableName());
-Assert.assertEquals(cachedKeys.get(0).getColumn_name(), "col1");
-Assert.assertEquals(cachedKeys.get(0).getCatName(), DEFAULT_CATALOG_NAME);
+Assert.assertEquals(origKeys,cachedKeys);

Review comment:
   Done

##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
##
@@ -1499,20 +1499,11 @@ SQLAllTableConstraints getAllTableConstraints(String 
catName, String dbName, Str
   /**
* Create a table with constraints
* @param tbl table definition
-   * @param primaryKeys primary key definition, or null
-   * @param foreignKeys foreign key definition, or null
-   * @param uniqueConstraints unique constraints definition, or null
-   * @param notNullConstraints not null constraints definition, or null
-   * @param defaultConstraints default values definition, or null
* @return list of constraint names

Review comment:
   Done





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 504229)
Time Spent: 1h  (was: 50m)

> [CachedStore] Data miss match between cachedstore and rawstore
> --
>
> Key: HIVE-24258
> URL: https://issues.apache.org/jira/browse/HIVE-24258
> Project: Hive
>  Issue Type: Improvement
>Reporter: Ashish Sharma
>Assignee: Sankar Hariappan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> Description
> Objects like table name, db name, column name etc are case insensitive as per 
> HIVE contract but standalone metastore cachedstore is case sensitive.  As 
> result of which there is mismatch in rawstore output and cachedstore output.
> Example - 
> expected:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]> 
> but was:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:Pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504227&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504227
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 16:13
Start Date: 23/Oct/20 16:13
Worklog Time Spent: 10m 
  Work Description: ashish-kumar-sharma commented on a change in pull 
request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r510992591



##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
##
@@ -2785,31 +2696,23 @@ public void 
add_not_null_constraint(AddNotNullConstraintRequest req)
 @Override
 public void add_default_constraint(AddDefaultConstraintRequest req)
 throws MetaException, InvalidObjectException {
-  List defaultConstraintCols= 
req.getDefaultConstraintCols();
-  String constraintName = (defaultConstraintCols != null && 
defaultConstraintCols.size() > 0) ?
-  defaultConstraintCols.get(0).getDc_name() : "null";
+  List defaultConstraints= 
req.getDefaultConstraintCols();

Review comment:
   done





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 504227)
Time Spent: 40m  (was: 0.5h)

> [CachedStore] Data miss match between cachedstore and rawstore
> --
>
> Key: HIVE-24258
> URL: https://issues.apache.org/jira/browse/HIVE-24258
> Project: Hive
>  Issue Type: Improvement
>Reporter: Ashish Sharma
>Assignee: Sankar Hariappan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Description
> Objects like table name, db name, column name etc are case insensitive as per 
> HIVE contract but standalone metastore cachedstore is case sensitive.  As 
> result of which there is mismatch in rawstore output and cachedstore output.
> Example - 
> expected:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]> 
> but was:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:Pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504228&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504228
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 16:13
Start Date: 23/Oct/20 16:13
Worklog Time Spent: 10m 
  Work Description: ashish-kumar-sharma commented on a change in pull 
request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r510992922



##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CacheUtils.java
##
@@ -58,14 +59,11 @@ public static String buildDbKeyWithDelimiterSuffix(String 
catName, String dbName
*
*/
   public static String buildPartitionCacheKey(List partVals) {
-if (partVals == null || partVals.isEmpty()) {
-  return "";
-}
-return String.join(delimit, partVals);
+return CollectionUtils.isNotEmpty(partVals) ? String.join(delimit, 
partVals) : "";
   }
 
   public static String buildTableKey(String catName, String dbName, String 
tableName) {
-return buildKey(catName.toLowerCase(), dbName.toLowerCase(), 
tableName.toLowerCase());
+return 
buildKey(StringUtils.normalizeIdentifier(catName),StringUtils.normalizeIdentifier(dbName),StringUtils.normalizeIdentifier(tableName));

Review comment:
   Done





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 504228)
Time Spent: 50m  (was: 40m)

> [CachedStore] Data miss match between cachedstore and rawstore
> --
>
> Key: HIVE-24258
> URL: https://issues.apache.org/jira/browse/HIVE-24258
> Project: Hive
>  Issue Type: Improvement
>Reporter: Ashish Sharma
>Assignee: Sankar Hariappan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Description
> Objects like table name, db name, column name etc are case insensitive as per 
> HIVE contract but standalone metastore cachedstore is case sensitive.  As 
> result of which there is mismatch in rawstore output and cachedstore output.
> Example - 
> expected:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]> 
> but was:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:Pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504226&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504226
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 16:12
Start Date: 23/Oct/20 16:12
Worklog Time Spent: 10m 
  Work Description: ashish-kumar-sharma commented on a change in pull 
request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r510992400



##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
##
@@ -2255,121 +2257,61 @@ private void create_table_core(final RawStore ms, 
final CreateTableRequest req)
   tbl.putToParameters(hive_metastoreConstants.DDL_TIME, 
Long.toString(time));
 }
 
-if (primaryKeys == null && foreignKeys == null
-&& uniqueConstraints == null && notNullConstraints == null && 
defaultConstraints == null
-&& checkConstraints == null) {
+if (CollectionUtils.isEmpty(constraints.getPrimaryKeys()) && 
CollectionUtils.isEmpty(constraints.getForeignKeys())
+&& 
CollectionUtils.isEmpty(constraints.getUniqueConstraints())&& 
CollectionUtils.isEmpty(constraints.getNotNullConstraints())&& 
CollectionUtils.isEmpty(constraints.getDefaultConstraints())
+&& CollectionUtils.isEmpty(constraints.getCheckConstraints())) {
   ms.createTable(tbl);
 } else {
   // Check that constraints have catalog name properly set first
-  if (primaryKeys != null && !primaryKeys.isEmpty() && 
!primaryKeys.get(0).isSetCatName()) {
-for (SQLPrimaryKey pkcol : primaryKeys) 
pkcol.setCatName(tbl.getCatName());
+  if (CollectionUtils.isNotEmpty(constraints.getPrimaryKeys()) && 
!constraints.getPrimaryKeys().get(0).isSetCatName()) {
+for (SQLPrimaryKey pkcol : constraints.getPrimaryKeys()) 
pkcol.setCatName(tbl.getCatName());

Review comment:
   Done





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 504226)
Time Spent: 0.5h  (was: 20m)

> [CachedStore] Data miss match between cachedstore and rawstore
> --
>
> Key: HIVE-24258
> URL: https://issues.apache.org/jira/browse/HIVE-24258
> Project: Hive
>  Issue Type: Improvement
>Reporter: Ashish Sharma
>Assignee: Sankar Hariappan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Description
> Objects like table name, db name, column name etc are case insensitive as per 
> HIVE contract but standalone metastore cachedstore is case sensitive.  As 
> result of which there is mismatch in rawstore output and cachedstore output.
> Example - 
> expected:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]> 
> but was:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:Pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504225&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504225
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 16:12
Start Date: 23/Oct/20 16:12
Worklog Time Spent: 10m 
  Work Description: ashish-kumar-sharma commented on a change in pull 
request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r510992214



##
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java
##
@@ -419,18 +412,14 @@ public void testConstraintsForUpdateUsingEvents() throws 
Exception {
   public void assertRawStoreAndCachedStoreConstraint(String catName, String 
dbName, String tblName)
   throws MetaException, NoSuchObjectException {
 SQLAllTableConstraints rawStoreConstraints = 
rawStore.getAllTableConstraints(catName, dbName, tblName);
-List primaryKeys = 
sharedCache.listCachedPrimaryKeys(catName, dbName, tblName);
-List notNullConstraints = 
sharedCache.listCachedNotNullConstraints(catName, dbName, tblName);
-List uniqueConstraints = 
sharedCache.listCachedUniqueConstraint(catName, dbName, tblName);
-List defaultConstraints = 
sharedCache.listCachedDefaultConstraint(catName, dbName, tblName);
-List checkConstraints = 
sharedCache.listCachedCheckConstraint(catName, dbName, tblName);
-List foreignKeys = 
sharedCache.listCachedForeignKeys(catName, dbName, tblName, null, null);
-Assert.assertEquals(rawStoreConstraints.getPrimaryKeys(), primaryKeys);
-Assert.assertEquals(rawStoreConstraints.getNotNullConstraints(), 
notNullConstraints);
-Assert.assertEquals(rawStoreConstraints.getUniqueConstraints(), 
uniqueConstraints);
-Assert.assertEquals(rawStoreConstraints.getDefaultConstraints(), 
defaultConstraints);
-Assert.assertEquals(rawStoreConstraints.getCheckConstraints(), 
checkConstraints);
-Assert.assertEquals(rawStoreConstraints.getForeignKeys(), foreignKeys);
+SQLAllTableConstraints cachedStoreConstraints = new 
SQLAllTableConstraints();
+
cachedStoreConstraints.setPrimaryKeys(sharedCache.listCachedPrimaryKeys(catName,
 dbName, tblName));
+
cachedStoreConstraints.setForeignKeys(sharedCache.listCachedForeignKeys(catName,
 dbName, tblName, null, null));
+
cachedStoreConstraints.setNotNullConstraints(sharedCache.listCachedNotNullConstraints(catName,
 dbName, tblName));
+
cachedStoreConstraints.setDefaultConstraints(sharedCache.listCachedDefaultConstraint(catName,
 dbName, tblName));
+
cachedStoreConstraints.setCheckConstraints(sharedCache.listCachedCheckConstraint(catName,
 dbName, tblName));
+
cachedStoreConstraints.setUniqueConstraints(sharedCache.listCachedUniqueConstraint(catName,
 dbName, tblName));
+Assert.assertEquals(rawStoreConstraints,cachedStoreConstraints);

Review comment:
   Done





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:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 504225)
Time Spent: 20m  (was: 10m)

> [CachedStore] Data miss match between cachedstore and rawstore
> --
>
> Key: HIVE-24258
> URL: https://issues.apache.org/jira/browse/HIVE-24258
> Project: Hive
>  Issue Type: Improvement
>Reporter: Ashish Sharma
>Assignee: Sankar Hariappan
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Description
> Objects like table name, db name, column name etc are case insensitive as per 
> HIVE contract but standalone metastore cachedstore is case sensitive.  As 
> result of which there is mismatch in rawstore output and cachedstore output.
> Example - 
> expected:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]> 
> but was:<[SQLPrimaryKey(table_db:test_table_ops, table_name:tbl, 
> column_name:col1, key_seq:1, pk_name:Pk1, enable_cstr:false, 
> validate_cstr:false, rely_cstr:false, catName:hive)]>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (HIVE-24258) [CachedStore] Data miss match between cachedstore and rawstore

2020-10-23 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/HIVE-24258?focusedWorklogId=504124&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-504124
 ]

ASF GitHub Bot logged work on HIVE-24258:
-

Author: ASF GitHub Bot
Created on: 23/Oct/20 11:28
Start Date: 23/Oct/20 11:28
Worklog Time Spent: 10m 
  Work Description: sankarh commented on a change in pull request #1587:
URL: https://github.com/apache/hive/pull/1587#discussion_r510806059



##
File path: 
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCachedStoreUpdateUsingEvents.java
##
@@ -419,18 +412,14 @@ public void testConstraintsForUpdateUsingEvents() throws 
Exception {
   public void assertRawStoreAndCachedStoreConstraint(String catName, String 
dbName, String tblName)
   throws MetaException, NoSuchObjectException {
 SQLAllTableConstraints rawStoreConstraints = 
rawStore.getAllTableConstraints(catName, dbName, tblName);
-List primaryKeys = 
sharedCache.listCachedPrimaryKeys(catName, dbName, tblName);
-List notNullConstraints = 
sharedCache.listCachedNotNullConstraints(catName, dbName, tblName);
-List uniqueConstraints = 
sharedCache.listCachedUniqueConstraint(catName, dbName, tblName);
-List defaultConstraints = 
sharedCache.listCachedDefaultConstraint(catName, dbName, tblName);
-List checkConstraints = 
sharedCache.listCachedCheckConstraint(catName, dbName, tblName);
-List foreignKeys = 
sharedCache.listCachedForeignKeys(catName, dbName, tblName, null, null);
-Assert.assertEquals(rawStoreConstraints.getPrimaryKeys(), primaryKeys);
-Assert.assertEquals(rawStoreConstraints.getNotNullConstraints(), 
notNullConstraints);
-Assert.assertEquals(rawStoreConstraints.getUniqueConstraints(), 
uniqueConstraints);
-Assert.assertEquals(rawStoreConstraints.getDefaultConstraints(), 
defaultConstraints);
-Assert.assertEquals(rawStoreConstraints.getCheckConstraints(), 
checkConstraints);
-Assert.assertEquals(rawStoreConstraints.getForeignKeys(), foreignKeys);
+SQLAllTableConstraints cachedStoreConstraints = new 
SQLAllTableConstraints();
+
cachedStoreConstraints.setPrimaryKeys(sharedCache.listCachedPrimaryKeys(catName,
 dbName, tblName));
+
cachedStoreConstraints.setForeignKeys(sharedCache.listCachedForeignKeys(catName,
 dbName, tblName, null, null));
+
cachedStoreConstraints.setNotNullConstraints(sharedCache.listCachedNotNullConstraints(catName,
 dbName, tblName));
+
cachedStoreConstraints.setDefaultConstraints(sharedCache.listCachedDefaultConstraint(catName,
 dbName, tblName));
+
cachedStoreConstraints.setCheckConstraints(sharedCache.listCachedCheckConstraint(catName,
 dbName, tblName));
+
cachedStoreConstraints.setUniqueConstraints(sharedCache.listCachedUniqueConstraint(catName,
 dbName, tblName));
+Assert.assertEquals(rawStoreConstraints,cachedStoreConstraints);

Review comment:
   nit: Add space after ,

##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
##
@@ -2255,121 +2257,61 @@ private void create_table_core(final RawStore ms, 
final CreateTableRequest req)
   tbl.putToParameters(hive_metastoreConstants.DDL_TIME, 
Long.toString(time));
 }
 
-if (primaryKeys == null && foreignKeys == null
-&& uniqueConstraints == null && notNullConstraints == null && 
defaultConstraints == null
-&& checkConstraints == null) {
+if (CollectionUtils.isEmpty(constraints.getPrimaryKeys()) && 
CollectionUtils.isEmpty(constraints.getForeignKeys())
+&& 
CollectionUtils.isEmpty(constraints.getUniqueConstraints())&& 
CollectionUtils.isEmpty(constraints.getNotNullConstraints())&& 
CollectionUtils.isEmpty(constraints.getDefaultConstraints())
+&& CollectionUtils.isEmpty(constraints.getCheckConstraints())) {
   ms.createTable(tbl);
 } else {
   // Check that constraints have catalog name properly set first
-  if (primaryKeys != null && !primaryKeys.isEmpty() && 
!primaryKeys.get(0).isSetCatName()) {
-for (SQLPrimaryKey pkcol : primaryKeys) 
pkcol.setCatName(tbl.getCatName());
+  if (CollectionUtils.isNotEmpty(constraints.getPrimaryKeys()) && 
!constraints.getPrimaryKeys().get(0).isSetCatName()) {
+for (SQLPrimaryKey pkcol : constraints.getPrimaryKeys()) 
pkcol.setCatName(tbl.getCatName());

Review comment:
   nit: Use for () { 
   --
   } 
   even for single statement.
   Or use this instead: constraints.getPrimaryKeys().forEach(pk -> 
pk.setCatName(tbl.getCatName()));

##
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
##
@@ -2785,31 +2696,23 @@ public void 
add_not_null_constraint(AddNotNullConstraintRequest req)
 @Override