当前位置: 首页>>代码示例>>Java>>正文


Java HiveObjectType类代码示例

本文整理汇总了Java中org.apache.hadoop.hive.metastore.api.HiveObjectType的典型用法代码示例。如果您正苦于以下问题:Java HiveObjectType类的具体用法?Java HiveObjectType怎么用?Java HiveObjectType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HiveObjectType类属于org.apache.hadoop.hive.metastore.api包,在下文中一共展示了HiveObjectType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
@Before
public void setUp() {
  databaseMapping = new DatabaseMappingImpl(metastoreMapping);
  database = new Database();
  database.setName(DB_NAME);
  partition = new Partition();
  partition.setDbName(DB_NAME);
  partitions = Lists.newArrayList(partition);
  index = new Index();
  index.setDbName(DB_NAME);
  hiveObjectRef = new HiveObjectRef();
  hiveObjectRef.setDbName(DB_NAME);
  hiveObjectRef.setObjectType(HiveObjectType.DATABASE);
  hiveObjectRef.setObjectName(DB_NAME);
  hiveObjectPrivileges = new ArrayList<>();
  HiveObjectPrivilege hiveObjectPrivilege = new HiveObjectPrivilege();
  hiveObjectPrivilege.setHiveObject(hiveObjectRef);
  hiveObjectPrivileges.add(hiveObjectPrivilege);
  partitionSpec = new PartitionSpec();
  partitionSpec.setDbName(DB_NAME);
  when(metastoreMapping.transformInboundDatabaseName(DB_NAME)).thenReturn(IN_DB_NAME);
  when(metastoreMapping.transformOutboundDatabaseName(DB_NAME)).thenReturn(OUT_DB_NAME);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:24,代码来源:DatabaseMappingImplTest.java

示例2: transformInboundHiveObjectRef

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
@Override
public HiveObjectRef transformInboundHiveObjectRef(HiveObjectRef obj) {
  obj.setDbName(metaStoreMapping.transformInboundDatabaseName(obj.getDbName()));
  if (obj.getObjectType() == HiveObjectType.DATABASE) {
    obj.setObjectName(metaStoreMapping.transformInboundDatabaseName(obj.getObjectName()));
  }
  return obj;
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:9,代码来源:DatabaseMappingImpl.java

示例3: transformOutboundHiveObjectRef

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
@Override
public HiveObjectRef transformOutboundHiveObjectRef(HiveObjectRef obj) {
  obj.setDbName(metaStoreMapping.transformOutboundDatabaseName(obj.getDbName()));
  if (obj.getObjectType() == HiveObjectType.DATABASE) {
    obj.setObjectName(metaStoreMapping.transformOutboundDatabaseName(obj.getObjectName()));
  }
  return obj;
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:9,代码来源:DatabaseMappingImpl.java

示例4: transformInboundHiveObjectRefObjectTypeIsNotDatabase

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
@Test
public void transformInboundHiveObjectRefObjectTypeIsNotDatabase() throws Exception {
  hiveObjectRef.setObjectType(HiveObjectType.TABLE);
  hiveObjectRef.setObjectName("table");
  HiveObjectRef result = databaseMapping.transformInboundHiveObjectRef(hiveObjectRef);
  assertThat(result, is(sameInstance(hiveObjectRef)));
  assertThat(result.getDbName(), is(IN_DB_NAME));
  assertThat(result.getObjectName(), is("table"));
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:10,代码来源:DatabaseMappingImplTest.java

示例5: transformOutboundHiveObjectRefObjectTypeIsNotDatabase

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
@Test
public void transformOutboundHiveObjectRefObjectTypeIsNotDatabase() throws Exception {
  hiveObjectRef.setObjectType(HiveObjectType.TABLE);
  hiveObjectRef.setObjectName("table");
  HiveObjectRef result = databaseMapping.transformOutboundHiveObjectRef(hiveObjectRef);
  assertThat(result, is(sameInstance(hiveObjectRef)));
  assertThat(result.getDbName(), is(OUT_DB_NAME));
  assertThat(result.getObjectName(), is("table"));
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:10,代码来源:DatabaseMappingImplTest.java

示例6: getDatabasePrivileges

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
@Override
public Set<HivePrivilege> getDatabasePrivileges(String user, String databaseName)
{
    ImmutableSet.Builder<HivePrivilege> privileges = ImmutableSet.builder();

    if (isDatabaseOwner(user, databaseName)) {
        privileges.add(OWNERSHIP);
    }
    privileges.addAll(getPrivileges(user, new HiveObjectRef(HiveObjectType.DATABASE, databaseName, null, null, null)));

    return privileges.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:CachingHiveMetastore.java

示例7: loadTablePrivileges

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
private Set<HivePrivilege> loadTablePrivileges(String user, String databaseName, String tableName)
{
    ImmutableSet.Builder<HivePrivilege> privileges = ImmutableSet.builder();

    if (isTableOwner(user, databaseName, tableName)) {
        privileges.add(OWNERSHIP);
    }
    privileges.addAll(getPrivileges(user, new HiveObjectRef(HiveObjectType.TABLE, databaseName, tableName, null, null)));

    return privileges.build();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:CachingHiveMetastore.java

示例8: hasPrivilegeToSetCleanAlert

import org.apache.hadoop.hive.metastore.api.HiveObjectType; //导入依赖的package包/类
public boolean hasPrivilegeToSetCleanAlert(String database, String table,
		String user) {
	HiveMetaStoreClient hiveClient = getHiveMetaStoreClient();
	HiveObjectRef hiveObject = new HiveObjectRef();
	hiveObject.setDbName(database);
	hiveObject.setObjectName(table);
	hiveObject.setObjectType(HiveObjectType.TABLE);
	List<HiveObjectPrivilege> privileges = new ArrayList<HiveObjectPrivilege>();
	try {
		privileges = hiveClient.list_privileges(user, PrincipalType.USER,
				hiveObject);
	} catch (Exception e) {
		logger.error("Error to get privileges:", e);
		return false;
	}
	for (HiveObjectPrivilege privilege : privileges) {
		String privilegeName = privilege.getGrantInfo().getPrivilege();
		if (privilegeName != null
				&& ("all".equalsIgnoreCase(privilegeName)
						|| "create".equalsIgnoreCase(privilegeName) || "ALTER"
							.equalsIgnoreCase(privilegeName))) {
			return true;
		}
	}

	return false;
}
 
开发者ID:Ctrip-DI,项目名称:Hue-Ctrip-DI,代码行数:28,代码来源:HiveHelper.java


注:本文中的org.apache.hadoop.hive.metastore.api.HiveObjectType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。