saihemanth-cloudera commented on code in PR #4092:
URL: https://github.com/apache/hive/pull/4092#discussion_r1127451194
##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/command/CommandAuthorizerV2.java:
##########
@@ -83,17 +84,16 @@ static void doAuthorization(HiveOperation op,
BaseSemanticAnalyzer sem, SessionS
ss.getAuthorizerV2().checkPrivileges(hiveOpType, inputsHObjs, outputHObjs,
authzContextBuilder.build());
}
- private static void addPermanentFunctionEntities(SessionState ss,
List<ReadEntity> inputList) throws HiveException {
+ private static void addPermanentFunctionEntities(SessionState ss,
List<ReadEntity> inputList, BaseSemanticAnalyzer sem) throws HiveException {
for (Entry<String, FunctionInfo> function :
ss.getCurrentFunctionsInUse().entrySet()) {
if (function.getValue().getFunctionType() != FunctionType.PERSISTENT) {
// Built-in function access is allowed to all users. If user can
create a temp function, they may use it.
continue;
}
String[] qualifiedFunctionName =
FunctionUtils.getQualifiedFunctionNameParts(function.getKey());
- // this is only for the purpose of authorization, only the name matters.
- Database db = new Database(qualifiedFunctionName[0], "", "", null);
- inputList.add(new ReadEntity(db, qualifiedFunctionName[1],
function.getValue().getClassName(), Type.FUNCTION));
+ // For the purpose of authorization, we need to send full function
object.
+ inputList.add(new
ReadEntity(sem.getDb().getFunction(qualifiedFunctionName[0],
qualifiedFunctionName[1])));
Review Comment:
I'll revert back on changes on this one. We don't need to fetch
full-function objects for all the functions in the current session as it is a
costly operation.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]