Skip to content

Commit

Permalink
Remove hive privilege null check
Browse files Browse the repository at this point in the history
Extracted-From: prestodb/presto#10904
  • Loading branch information
Andrii Rosa authored and sopel39 committed Jan 29, 2019
1 parent 942cde9 commit d455185
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Expand Up @@ -106,8 +106,9 @@ public static HivePrivilege toHivePrivilege(Privilege privilege)
return DELETE;
case UPDATE:
return UPDATE;
default:
throw new IllegalArgumentException("Unexpected privilege: " + privilege);
}
return null;
}

public boolean isContainedIn(HivePrivilegeInfo hivePrivilegeInfo)
Expand Down
Expand Up @@ -253,8 +253,7 @@ public void checkCanGrantTablePrivilege(ConnectorTransactionHandle transaction,
return;
}

HivePrivilege hivePrivilege = toHivePrivilege(privilege);
if (hivePrivilege == null || !hasGrantOptionForPrivilege(transaction, identity, privilege, tableName)) {
if (!hasGrantOptionForPrivilege(transaction, identity, privilege, tableName)) {
denyGrantTablePrivilege(privilege.name(), tableName.toString());
}
}
Expand All @@ -266,8 +265,7 @@ public void checkCanRevokeTablePrivilege(ConnectorTransactionHandle transaction,
return;
}

HivePrivilege hivePrivilege = toHivePrivilege(privilege);
if (hivePrivilege == null || !hasGrantOptionForPrivilege(transaction, identity, privilege, tableName)) {
if (!hasGrantOptionForPrivilege(transaction, identity, privilege, tableName)) {
denyRevokeTablePrivilege(privilege.name(), tableName.toString());
}
}
Expand Down

0 comments on commit d455185

Please sign in to comment.