dengzhhu653 commented on code in PR #6969:
URL: https://github.com/apache/hive/pull/6969#discussion_r4615040237
##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HivePrivilegeObject.java:
##########
@@ -164,105 +175,148 @@ public enum HivePrivObjectActionType {
// is applied to the table.
private String rowFilterExpression;
+ /**
+ * Used by external authorizers (e.g. Ranger, Sentry). Use {@link
#builder(HivePrivilegeObjectType)} instead.
+ */
@Deprecated
public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName) {
- this(type, dbname, objectName, HivePrivObjectActionType.OTHER);
+ this(type, null, dbname, objectName, null, null, null, null, null, null,
null);
}
+ /**
+ * Used by external authorizers (e.g. Ranger, Sentry). Use {@link
#builder(HivePrivilegeObjectType)} instead.
+ */
@Deprecated
- public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName
- , HivePrivObjectActionType actionType) {
- this(type, dbname, objectName, null, null, actionType, null, null);
+ public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName,
+ HivePrivObjectActionType actionType) {
+ this(type, null, dbname, objectName, null, null, actionType, null, null,
null, null);
}
+ /**
+ * Used by external authorizers (e.g. Ranger, Sentry). Use {@link
#builder(HivePrivilegeObjectType)} instead.
+ */
@Deprecated
public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName,
List<String> partKeys, String column) {
- this(type, dbname, objectName, partKeys,
- column == null ? null : Arrays.asList(column),
- HivePrivObjectActionType.OTHER, null, null);
- }
-
- public HivePrivilegeObject(HivePrivilegeObjectType type, String objectName) {
- this(type, null, null, objectName);
- }
-
- public HivePrivilegeObject(HivePrivilegeObjectType type, String catName,
String dbname, String objectName) {
- this(type, catName, dbname, objectName, null, null);
- }
-
- public HivePrivilegeObject(HivePrivilegeObjectType type, String catName,
String dbname, String objectName,
- List<String> partKeys, List<String> columns) {
- this(type, catName, dbname, objectName, partKeys, columns,
HivePrivObjectActionType.OTHER, null);
- }
-
- public HivePrivilegeObject(HivePrivilegeObjectType type, String catName,
String dbname, String objectName,
- List<String> partKeys, List<String> columns, HivePrivObjectActionType
actionType, List<String> commandParams) {
- this(type, catName, dbname, objectName, partKeys, columns, actionType,
commandParams, null, null, null);
+ this(type, null, dbname, objectName, partKeys, column == null ? null :
Arrays.asList(column),
+ null, null, null, null, null);
}
/**
- * Create HivePrivilegeObject of type {@link
HivePrivilegeObjectType#COMMAND_PARAMS}
+ * Create HivePrivilegeObject of type {@link
HivePrivilegeObjectType#COMMAND_PARAMS}.
* @param cmdParams
* @return
*/
public static HivePrivilegeObject createHivePrivilegeObject(List<String>
cmdParams) {
- return new HivePrivilegeObject(HivePrivilegeObjectType.COMMAND_PARAMS,
null, null,
- null, null, null,null, cmdParams);
- }
-
- @Deprecated
- public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName,
- List<String> partKeys, List<String> columns, List<String> commandParams) {
- this(type, dbname, objectName, partKeys, columns,
HivePrivObjectActionType.OTHER, commandParams, null);
- }
-
- @Deprecated
- public HivePrivilegeObject(String dbname, String objectName, List<String>
columns) {
- this(HivePrivilegeObjectType.TABLE_OR_VIEW, null, dbname, objectName,
null, columns);
- }
-
- @Deprecated
- public HivePrivilegeObject(String dbname, String objectName, List<String>
columns,
- String ownerName, PrincipalType ownerType) {
- this(HivePrivilegeObjectType.TABLE_OR_VIEW, dbname, objectName, null,
columns,
- HivePrivObjectActionType.OTHER, null, null, ownerName, ownerType);
- }
-
- @Deprecated
- public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName, List<String> partKeys,
- List<String> columns, HivePrivObjectActionType actionType, List<String>
commandParams, String className) {
- this(type, dbname, objectName, partKeys, columns, actionType,
commandParams, className, null, null);
- }
-
- @Deprecated
- public HivePrivilegeObject(HivePrivilegeObjectType type, String dbname,
String objectName, List<String> partKeys,
- List<String> columns, HivePrivObjectActionType actionType, List<String>
commandParams, String className,
- String ownerName, PrincipalType ownerType) {
- this(type, null, dbname, objectName, partKeys, columns, actionType,
commandParams, className, ownerName,
- ownerType);
+ return
builder(HivePrivilegeObjectType.COMMAND_PARAMS).commandParams(cmdParams).build();
Review Comment:
Ranger and Sentry don't use these constructors, for others who upgrade to
new Hive should use the new Builder instead
--
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]