org.apache.hadoop.hive.metastore.api.Table.getPrivileges()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.getPrivileges()方法的一些代码示例,展示了Table.getPrivileges()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getPrivileges()方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:getPrivileges

Table.getPrivileges介绍

暂无

代码示例

代码示例来源:origin: apache/hive

@Override
public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
  String userName, List<String> groupNames) throws MetaException,
  TException {
 // If caller is looking for temp table, handle here. Otherwise pass on to underlying client.
 if (hiveObject.getObjectType() == HiveObjectType.TABLE) {
  org.apache.hadoop.hive.metastore.api.Table table =
    getTempTable(hiveObject.getDbName(), hiveObject.getObjectName());
  if (table != null) {
   return deepCopy(table.getPrivileges());
  }
 }
 return super.get_privilege_set(hiveObject, userName, groupNames);
}

代码示例来源:origin: apache/drill

@Override
public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
  String userName, List<String> groupNames) throws MetaException,
  TException {
 // If caller is looking for temp table, handle here. Otherwise pass on to underlying client.
 if (hiveObject.getObjectType() == HiveObjectType.TABLE) {
  org.apache.hadoop.hive.metastore.api.Table table =
    getTempTable(hiveObject.getDbName(), hiveObject.getObjectName());
  if (table != null) {
   return deepCopy(table.getPrivileges());
  }
 }
 return super.get_privilege_set(hiveObject, userName, groupNames);
}

代码示例来源:origin: prestodb/presto

PrincipalPrivilegeSet privileges = table.getPrivileges();
if (privileges != null) {
  for (Entry<String, List<PrivilegeGrantInfo>> entry : privileges.getUserPrivileges().entrySet()) {

代码示例来源:origin: apache/hive

PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
List<Object> toPersistPrivObjs = new ArrayList<>();
if (principalPrivs != null) {

代码示例来源:origin: apache/hive

return getPrivileges();

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
public PrincipalPrivilegeSet get_privilege_set(HiveObjectRef hiveObject,
  String userName, List<String> groupNames) throws MetaException,
  TException {
 // If caller is looking for temp table, handle here. Otherwise pass on to underlying client.
 if (hiveObject.getObjectType() == HiveObjectType.TABLE) {
  org.apache.hadoop.hive.metastore.api.Table table =
    getTempTable(hiveObject.getDbName(), hiveObject.getObjectName());
  if (table != null) {
   return deepCopy(table.getPrivileges());
  }
 }
 return super.get_privilege_set(hiveObject, userName, groupNames);
}

代码示例来源:origin: org.apache.hadoop.hive/hive-metastore

return getPrivileges();

代码示例来源:origin: org.spark-project.hive/hive-metastore

return getPrivileges();

代码示例来源:origin: com.facebook.presto.hive/hive-apache

return getPrivileges();

代码示例来源:origin: io.prestosql/presto-hive

@Override
public synchronized void createTable(Table table)
{
  TableType tableType = TableType.valueOf(table.getTableType());
  checkArgument(EnumSet.of(MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW).contains(tableType), "Invalid table type: %s", tableType);
  if (tableType == VIRTUAL_VIEW) {
    checkArgument(table.getSd().getLocation() == null, "Storage location for view must be null");
  }
  else {
    File directory = new File(new Path(table.getSd().getLocation()).toUri());
    checkArgument(directory.exists(), "Table directory does not exist");
    if (tableType == MANAGED_TABLE) {
      checkArgument(isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory");
    }
  }
  SchemaTableName schemaTableName = new SchemaTableName(table.getDbName(), table.getTableName());
  Table tableCopy = table.deepCopy();
  if (relations.putIfAbsent(schemaTableName, tableCopy) != null) {
    throw new TableAlreadyExistsException(schemaTableName);
  }
  if (tableType == VIRTUAL_VIEW) {
    views.put(schemaTableName, tableCopy);
  }
  PrincipalPrivilegeSet privileges = table.getPrivileges();
  if (privileges != null) {
    throw new UnsupportedOperationException();
  }
}

代码示例来源:origin: prestosql/presto

@Override
public synchronized void createTable(Table table)
{
  TableType tableType = TableType.valueOf(table.getTableType());
  checkArgument(EnumSet.of(MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW).contains(tableType), "Invalid table type: %s", tableType);
  if (tableType == VIRTUAL_VIEW) {
    checkArgument(table.getSd().getLocation() == null, "Storage location for view must be null");
  }
  else {
    File directory = new File(new Path(table.getSd().getLocation()).toUri());
    checkArgument(directory.exists(), "Table directory does not exist");
    if (tableType == MANAGED_TABLE) {
      checkArgument(isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory");
    }
  }
  SchemaTableName schemaTableName = new SchemaTableName(table.getDbName(), table.getTableName());
  Table tableCopy = table.deepCopy();
  if (relations.putIfAbsent(schemaTableName, tableCopy) != null) {
    throw new TableAlreadyExistsException(schemaTableName);
  }
  if (tableType == VIRTUAL_VIEW) {
    views.put(schemaTableName, tableCopy);
  }
  PrincipalPrivilegeSet privileges = table.getPrivileges();
  if (privileges != null) {
    throw new UnsupportedOperationException();
  }
}

代码示例来源:origin: org.apache.hadoop.hive/hive-metastore

public void createTable(Table tbl) throws InvalidObjectException, MetaException {
 boolean commited = false;
 try {
  openTransaction();
  MTable mtbl = convertToMTable(tbl);
  pm.makePersistent(mtbl);
  PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  List<Object> toPersistPrivObjs = new ArrayList<Object>();
  if (principalPrivs != null) {
   int now = (int)(System.currentTimeMillis()/1000);
   Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
   Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
   
   Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  }
  pm.makePersistentAll(toPersistPrivObjs);
  commited = commitTransaction();
 } finally {
  if (!commited) {
   rollbackTransaction();
  }
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
public void createTable(Table tbl) throws InvalidObjectException, MetaException {
 boolean commited = false;
 try {
  openTransaction();
  MTable mtbl = convertToMTable(tbl);
  pm.makePersistent(mtbl);
  PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  List<Object> toPersistPrivObjs = new ArrayList<Object>();
  if (principalPrivs != null) {
   int now = (int)(System.currentTimeMillis()/1000);
   Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
   Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
   Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  }
  pm.makePersistentAll(toPersistPrivObjs);
  commited = commitTransaction();
 } finally {
  if (!commited) {
   rollbackTransaction();
  }
 }
}

代码示例来源:origin: org.spark-project.hive/hive-metastore

@Override
public void createTable(Table tbl) throws InvalidObjectException, MetaException {
 boolean commited = false;
 try {
  openTransaction();
  MTable mtbl = convertToMTable(tbl);
  pm.makePersistent(mtbl);
  PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  List<Object> toPersistPrivObjs = new ArrayList<Object>();
  if (principalPrivs != null) {
   int now = (int)(System.currentTimeMillis()/1000);
   Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
   Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
   Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  }
  pm.makePersistentAll(toPersistPrivObjs);
  commited = commitTransaction();
 } finally {
  if (!commited) {
   rollbackTransaction();
  }
 }
}

代码示例来源:origin: edu.berkeley.cs.shark/hive-metastore

public void createTable(Table tbl) throws InvalidObjectException, MetaException {
 boolean commited = false;
 try {
  openTransaction();
  MTable mtbl = convertToMTable(tbl);
  pm.makePersistent(mtbl);
  PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  List<Object> toPersistPrivObjs = new ArrayList<Object>();
  if (principalPrivs != null) {
   int now = (int)(System.currentTimeMillis()/1000);
   Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
   Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
   Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  }
  pm.makePersistentAll(toPersistPrivObjs);
  commited = commitTransaction();
 } finally {
  if (!commited) {
   rollbackTransaction();
  }
 }
}

代码示例来源:origin: com.facebook.presto/presto-hive

PrincipalPrivilegeSet privileges = table.getPrivileges();
if (privileges != null) {
  for (Entry<String, List<PrivilegeGrantInfo>> entry : privileges.getUserPrivileges().entrySet()) {

代码示例来源:origin: uk.co.nichesolutions.presto/presto-hive

PrincipalPrivilegeSet privileges = table.getPrivileges();
if (privileges != null) {
  for (Entry<String, List<PrivilegeGrantInfo>> entry : privileges.getUserPrivileges().entrySet()) {

代码示例来源:origin: org.apache.hive/hive-standalone-metastore

@Override
public void createTable(Table tbl) throws InvalidObjectException, MetaException {
 boolean commited = false;
 try {
  openTransaction();
  MTable mtbl = convertToMTable(tbl);
  pm.makePersistent(mtbl);
  if (tbl.getCreationMetadata() != null) {
   MCreationMetadata mcm = convertToMCreationMetadata(tbl.getCreationMetadata());
   pm.makePersistent(mcm);
  }
  PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  List<Object> toPersistPrivObjs = new ArrayList<>();
  if (principalPrivs != null) {
   int now = (int)(System.currentTimeMillis()/1000);
   Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER, "SQL");
   Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP, "SQL");
   Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
   putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE, "SQL");
  }
  pm.makePersistentAll(toPersistPrivObjs);
  commited = commitTransaction();
 } finally {
  if (!commited) {
   rollbackTransaction();
  }
 }
}

代码示例来源:origin: org.apache.hive/hive-standalone-metastore

return getPrivileges();

相关文章

Table类方法