From 54fa2bf3dae195027b61eb78f7cb499bcd19f0ad Mon Sep 17 00:00:00 2001 From: Summer Xia Date: Thu, 10 Jan 2019 11:57:51 +0800 Subject: [PATCH] fix null string check for C++ using thrift api thrift generate C++ files, using (std::string& principalName) as list_privileges parameters. When it only checks null in java code, null string can not be passed by C++ api only if generated source code is modified. api in generated ThriftHiveMetastore.h is: void list_privileges(std::vector & _return, const std::string& principal_name, const PrincipalType::type principal_type, const HiveObjectRef& hiveObject); --- .../java/org/apache/hadoop/hive/metastore/HiveMetaStore.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index a9398ae1e794..8443c2095146 100644 --- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -6721,7 +6721,7 @@ private List list_table_privileges( if (dbName == null) { return getMS().listPrincipalTableGrantsAll(principalName, principalType); } - if (principalName == null) { + if (StringUtil.isNullOrEmpty(principalName)) { return getMS().listTableGrantsAll(catName, dbName, tableName); } return getMS().listAllTableGrants(principalName, principalType, catName, dbName, tableName);