Skip to content

Commit

Permalink
Add ownerType info for create database
Browse files Browse the repository at this point in the history
  • Loading branch information
Aggarwal-Raghav committed Jan 27, 2025
1 parent cb3b8f6 commit 4d5fd57
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 @@ -23,6 +23,7 @@
import org.apache.hadoop.hive.metastore.api.DataConnector;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.DatabaseType;
import org.apache.hadoop.hive.metastore.api.PrincipalType;
import org.apache.hadoop.hive.ql.QueryState;
import org.apache.hadoop.hive.ql.exec.TaskFactory;
import org.apache.hadoop.hive.ql.ddl.DDLSemanticAnalyzerFactory.DDLType;
Expand Down Expand Up @@ -115,6 +116,7 @@ public void analyzeInternal(ASTNode root) throws SemanticException {
database.setRemote_dbname(remoteDbName);
}
database.setOwnerName(SessionState.getUserFromAuthenticator());
database.setOwnerType(PrincipalType.USER);
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 OWNER: testuser}
HIVE PRIVILEGE OBJECT { type: DATABASE actionType: OTHER dbName: test_auth_obj_db OWNER: testuser OWNERTYPE: USER}
PREHOOK: query: CREATE DATABASE test_auth_obj_db
PREHOOK: type: CREATEDATABASE
PREHOOK: Output: database:test_auth_obj_db
Expand Down

0 comments on commit 4d5fd57

Please sign in to comment.