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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]