Package org.apache.hadoop.hive.ql.exec

Examples of org.apache.hadoop.hive.ql.exec.SentryHivePrivilegeObjectDesc


      HashSet<WriteEntity> outputs) throws SemanticException {
    List<PrivilegeDesc> privilegeDesc = analyzePrivilegeListDef(
        (ASTNode) ast.getChild(0));
    List<PrincipalDesc> principalDesc = analyzePrincipalListDef(
        (ASTNode) ast.getChild(1));
    SentryHivePrivilegeObjectDesc privilegeObj = null;

    if (ast.getChildCount() > 2) {
      for (int i = 2; i < ast.getChildCount(); i++) {
        ASTNode astChild = (ASTNode) ast.getChild(i);
        if (astChild.getType() == HiveParser.TOK_GRANT_WITH_OPTION) {
          throw new SemanticException(SentryHiveConstants.GRANT_OPTION_NOT_SUPPORTED);
        } else if (astChild.getType() == HiveParser.TOK_PRIV_OBJECT) {
          privilegeObj = analyzePrivilegeObject(astChild);
        }
      }
    }
    String userName = null;
    if (SessionState.get() != null
        && SessionState.get().getAuthenticator() != null) {
      userName = SessionState.get().getAuthenticator().getUserName();
    }
    Preconditions.checkNotNull(privilegeObj, "privilegeObj is null for " + ast.dump());
    if (privilegeObj.getPartSpec() != null) {
      throw new SemanticException(SentryHiveConstants.PARTITION_PRIVS_NOT_SUPPORTED);
    }
    for (PrivilegeDesc privDesc : privilegeDesc) {
      List<String> columns = privDesc.getColumns();
      if (columns != null && !columns.isEmpty()) {
View Full Code Here


    return createTask(new DDLWork(inputs, outputs, showRolesDesc));
  }

  private SentryHivePrivilegeObjectDesc analyzePrivilegeObject(ASTNode ast)
      throws SemanticException {
    SentryHivePrivilegeObjectDesc subject = new SentryHivePrivilegeObjectDesc();
    String privilegeObject = BaseSemanticAnalyzer.unescapeIdentifier(ast
        .getChild(0).getText());
    if (ast.getChildCount() > 1) {
      for (int i = 1; i < ast.getChildCount(); i++) {
        ASTNode astChild = (ASTNode) ast.getChild(i);
        if (astChild.getToken().getType() == HiveParser.TOK_PARTSPEC) {
          throw new SemanticException(SentryHiveConstants.PARTITION_PRIVS_NOT_SUPPORTED);
        } else if (astChild.getToken().getType() == HiveParser.TOK_TABCOLNAME) {
          throw new SemanticException(SentryHiveConstants.COLUMN_PRIVS_NOT_SUPPORTED);
        }else if (astChild.getToken().getType() == HiveParser.TOK_URI) {
          privilegeObject = privilegeObject.replaceAll("'", "").replaceAll("\"", "");
          subject.setUri(true);
        } else if (astChild.getToken().getType() == HiveParser.TOK_SERVER) {
          subject.setServer(true);
        } else {
          subject.setTable(true);
        }
      }
    }
    subject.setObject(privilegeObject);
    return subject;
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.exec.SentryHivePrivilegeObjectDesc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.