[ 
https://issues.apache.org/jira/browse/HIVE-25545?focusedWorklogId=657392&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-657392
 ]

ASF GitHub Bot logged work on HIVE-25545:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Sep/21 16:37
            Start Date: 29/Sep/21 16:37
    Worklog Time Spent: 10m 
      Work Description: saihemanth-cloudera commented on a change in pull 
request #2665:
URL: https://github.com/apache/hive/pull/2665#discussion_r718698639



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/constraint/drop/AlterTableDropConstraintAnalyzer.java
##########
@@ -47,11 +51,18 @@ protected void analyzeCommand(TableName tableName, 
Map<String, String> partition
     String constraintName = unescapeIdentifier(command.getChild(0).getText());
 
     AlterTableDropConstraintDesc desc = new 
AlterTableDropConstraintDesc(tableName, null, constraintName);
-    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), 
desc)));
 
     Table table = getTable(tableName);
+    WriteEntity.WriteType writeType = null;
     if (AcidUtils.isTransactionalTable(table)) {
       setAcidDdlDesc(desc);
+      writeType = WriteType.DDL_EXCLUSIVE;
+    } else {
+      writeType = 
WriteEntity.determineAlterTableWriteType(AlterTableType.DROP_CONSTRAINT);
     }
+    inputs.add(new ReadEntity(table));

Review comment:
       AlterTableDropConstraintDesc doesn't extend 
AbstractAlterTableWithConstraintsDesc as is the case with 
AlterTableAddConstraintDesc, So it cannot convert the descriptor object to add 
inputs and outputs. The reason why  AlterTableDropConstraintDesc cannot extend 
AbstractAlterTableWithConstraintsDesc is that the input command only issues the 
constraint name (ALTER TABLE foo DROP CONSTRAINT foo_constraint) but not the 
constraint object (which is the case with ADD constraint) and 
AbstractAlterTableWithConstraintsDesc takes constraint as an argument. 




-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 657392)
    Time Spent: 50m  (was: 40m)

> Add/Drop constraints events on table should create authorizable events in HS2
> -----------------------------------------------------------------------------
>
>                 Key: HIVE-25545
>                 URL: https://issues.apache.org/jira/browse/HIVE-25545
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>            Reporter: Sai Hemanth Gantasala
>            Assignee: Sai Hemanth Gantasala
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Alter table foo_tbl ADD constraint c1_unique UNIQUE(id1) disable novalidate;
> Alter table foo_tbl DROP constraint c1_unique;
> The above statements are currently not being authorized in Ranger/Sentry. 
> These should be authorized by creating authorizable events in Hive.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to