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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. return getPrivileges();

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

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

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

  1. return getPrivileges();

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

  1. return getPrivileges();

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

  1. return getPrivileges();

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

  1. @Override
  2. public synchronized void createTable(Table table)
  3. {
  4. TableType tableType = TableType.valueOf(table.getTableType());
  5. checkArgument(EnumSet.of(MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW).contains(tableType), "Invalid table type: %s", tableType);
  6. if (tableType == VIRTUAL_VIEW) {
  7. checkArgument(table.getSd().getLocation() == null, "Storage location for view must be null");
  8. }
  9. else {
  10. File directory = new File(new Path(table.getSd().getLocation()).toUri());
  11. checkArgument(directory.exists(), "Table directory does not exist");
  12. if (tableType == MANAGED_TABLE) {
  13. checkArgument(isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory");
  14. }
  15. }
  16. SchemaTableName schemaTableName = new SchemaTableName(table.getDbName(), table.getTableName());
  17. Table tableCopy = table.deepCopy();
  18. if (relations.putIfAbsent(schemaTableName, tableCopy) != null) {
  19. throw new TableAlreadyExistsException(schemaTableName);
  20. }
  21. if (tableType == VIRTUAL_VIEW) {
  22. views.put(schemaTableName, tableCopy);
  23. }
  24. PrincipalPrivilegeSet privileges = table.getPrivileges();
  25. if (privileges != null) {
  26. throw new UnsupportedOperationException();
  27. }
  28. }

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

  1. @Override
  2. public synchronized void createTable(Table table)
  3. {
  4. TableType tableType = TableType.valueOf(table.getTableType());
  5. checkArgument(EnumSet.of(MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW).contains(tableType), "Invalid table type: %s", tableType);
  6. if (tableType == VIRTUAL_VIEW) {
  7. checkArgument(table.getSd().getLocation() == null, "Storage location for view must be null");
  8. }
  9. else {
  10. File directory = new File(new Path(table.getSd().getLocation()).toUri());
  11. checkArgument(directory.exists(), "Table directory does not exist");
  12. if (tableType == MANAGED_TABLE) {
  13. checkArgument(isParentDir(directory, baseDirectory), "Table directory must be inside of the metastore base directory");
  14. }
  15. }
  16. SchemaTableName schemaTableName = new SchemaTableName(table.getDbName(), table.getTableName());
  17. Table tableCopy = table.deepCopy();
  18. if (relations.putIfAbsent(schemaTableName, tableCopy) != null) {
  19. throw new TableAlreadyExistsException(schemaTableName);
  20. }
  21. if (tableType == VIRTUAL_VIEW) {
  22. views.put(schemaTableName, tableCopy);
  23. }
  24. PrincipalPrivilegeSet privileges = table.getPrivileges();
  25. if (privileges != null) {
  26. throw new UnsupportedOperationException();
  27. }
  28. }

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

  1. public void createTable(Table tbl) throws InvalidObjectException, MetaException {
  2. boolean commited = false;
  3. try {
  4. openTransaction();
  5. MTable mtbl = convertToMTable(tbl);
  6. pm.makePersistent(mtbl);
  7. PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  8. List<Object> toPersistPrivObjs = new ArrayList<Object>();
  9. if (principalPrivs != null) {
  10. int now = (int)(System.currentTimeMillis()/1000);
  11. Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
  12. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
  13. Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
  14. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
  15. Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
  16. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  17. }
  18. pm.makePersistentAll(toPersistPrivObjs);
  19. commited = commitTransaction();
  20. } finally {
  21. if (!commited) {
  22. rollbackTransaction();
  23. }
  24. }
  25. }

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

  1. @Override
  2. public void createTable(Table tbl) throws InvalidObjectException, MetaException {
  3. boolean commited = false;
  4. try {
  5. openTransaction();
  6. MTable mtbl = convertToMTable(tbl);
  7. pm.makePersistent(mtbl);
  8. PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  9. List<Object> toPersistPrivObjs = new ArrayList<Object>();
  10. if (principalPrivs != null) {
  11. int now = (int)(System.currentTimeMillis()/1000);
  12. Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
  13. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
  14. Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
  15. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
  16. Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
  17. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  18. }
  19. pm.makePersistentAll(toPersistPrivObjs);
  20. commited = commitTransaction();
  21. } finally {
  22. if (!commited) {
  23. rollbackTransaction();
  24. }
  25. }
  26. }

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

  1. @Override
  2. public void createTable(Table tbl) throws InvalidObjectException, MetaException {
  3. boolean commited = false;
  4. try {
  5. openTransaction();
  6. MTable mtbl = convertToMTable(tbl);
  7. pm.makePersistent(mtbl);
  8. PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  9. List<Object> toPersistPrivObjs = new ArrayList<Object>();
  10. if (principalPrivs != null) {
  11. int now = (int)(System.currentTimeMillis()/1000);
  12. Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
  13. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
  14. Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
  15. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
  16. Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
  17. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  18. }
  19. pm.makePersistentAll(toPersistPrivObjs);
  20. commited = commitTransaction();
  21. } finally {
  22. if (!commited) {
  23. rollbackTransaction();
  24. }
  25. }
  26. }

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

  1. public void createTable(Table tbl) throws InvalidObjectException, MetaException {
  2. boolean commited = false;
  3. try {
  4. openTransaction();
  5. MTable mtbl = convertToMTable(tbl);
  6. pm.makePersistent(mtbl);
  7. PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  8. List<Object> toPersistPrivObjs = new ArrayList<Object>();
  9. if (principalPrivs != null) {
  10. int now = (int)(System.currentTimeMillis()/1000);
  11. Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
  12. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER);
  13. Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
  14. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP);
  15. Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
  16. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE);
  17. }
  18. pm.makePersistentAll(toPersistPrivObjs);
  19. commited = commitTransaction();
  20. } finally {
  21. if (!commited) {
  22. rollbackTransaction();
  23. }
  24. }
  25. }

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

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

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

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

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

  1. @Override
  2. public void createTable(Table tbl) throws InvalidObjectException, MetaException {
  3. boolean commited = false;
  4. try {
  5. openTransaction();
  6. MTable mtbl = convertToMTable(tbl);
  7. pm.makePersistent(mtbl);
  8. if (tbl.getCreationMetadata() != null) {
  9. MCreationMetadata mcm = convertToMCreationMetadata(tbl.getCreationMetadata());
  10. pm.makePersistent(mcm);
  11. }
  12. PrincipalPrivilegeSet principalPrivs = tbl.getPrivileges();
  13. List<Object> toPersistPrivObjs = new ArrayList<>();
  14. if (principalPrivs != null) {
  15. int now = (int)(System.currentTimeMillis()/1000);
  16. Map<String, List<PrivilegeGrantInfo>> userPrivs = principalPrivs.getUserPrivileges();
  17. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, userPrivs, PrincipalType.USER, "SQL");
  18. Map<String, List<PrivilegeGrantInfo>> groupPrivs = principalPrivs.getGroupPrivileges();
  19. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, groupPrivs, PrincipalType.GROUP, "SQL");
  20. Map<String, List<PrivilegeGrantInfo>> rolePrivs = principalPrivs.getRolePrivileges();
  21. putPersistentPrivObjects(mtbl, toPersistPrivObjs, now, rolePrivs, PrincipalType.ROLE, "SQL");
  22. }
  23. pm.makePersistentAll(toPersistPrivObjs);
  24. commited = commitTransaction();
  25. } finally {
  26. if (!commited) {
  27. rollbackTransaction();
  28. }
  29. }
  30. }

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

  1. return getPrivileges();

相关文章

Table类方法