本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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"));
}
示例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"));
}
示例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();
}
示例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();
}
示例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;
}