Skip to content

Commit

Permalink
HIVE-28716: Add owner information in HivePrivilegeObject for create d…
Browse files Browse the repository at this point in the history
…atabase query

Check RANGER-5097 for more info
  • Loading branch information
Aggarwal-Raghav committed Jan 22, 2025
1 parent 5146dba commit cb3b8f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
import org.apache.hadoop.hive.ql.parse.HiveParser;
import org.apache.hadoop.hive.ql.parse.SemanticException;
import org.apache.hadoop.hive.ql.session.SessionState;

/**
* Analyzer for database creation commands.
Expand Down Expand Up @@ -113,6 +114,7 @@ public void analyzeInternal(ASTNode root) throws SemanticException {
database.setType(DatabaseType.REMOTE);
database.setRemote_dbname(remoteDbName);
}
database.setOwnerName(SessionState.getUserFromAuthenticator());
rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc)));
outputs.add(new WriteEntity(database, WriteEntity.WriteType.DDL_NO_LOCK));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outputHObjs:
HIVE PRIVILEGE OBJECT { type: DATABASE actionType: OTHER dbName: test_auth_obj_db}
HIVE PRIVILEGE OBJECT { type: DATABASE actionType: OTHER dbName: test_auth_obj_db OWNER: testuser}
PREHOOK: query: CREATE DATABASE test_auth_obj_db
PREHOOK: type: CREATEDATABASE
PREHOOK: Output: database:test_auth_obj_db
Expand Down

0 comments on commit cb3b8f6

Please sign in to comment.