org.apache.hadoop.hive.metastore.api.UnknownTableException Java Examples

The following examples show how to use org.apache.hadoop.hive.metastore.api.UnknownTableException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 6 votes vote down vote up
@Override
public org.apache.hadoop.hive.metastore.api.Partition getPartitionWithAuthInfo(
      String databaseName, String tableName, List<String> values,
      String userName, List<String> groupNames)
      throws MetaException, UnknownTableException, NoSuchObjectException, TException {

    // TODO move this into the service
    org.apache.hadoop.hive.metastore.api.Partition partition = getPartition(databaseName, tableName, values);
    org.apache.hadoop.hive.metastore.api.Table table = getTable(databaseName, tableName);
    if ("TRUE".equalsIgnoreCase(table.getParameters().get("PARTITION_LEVEL_PRIVILEGE"))) {
        String partName = Warehouse.makePartName(table.getPartitionKeys(), values);
        HiveObjectRef obj = new HiveObjectRef();
        obj.setObjectType(HiveObjectType.PARTITION);
        obj.setDbName(databaseName);
        obj.setObjectName(tableName);
        obj.setPartValues(values);
        org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet privilegeSet =
              this.get_privilege_set(obj, userName, groupNames);
        partition.setPrivileges(privilegeSet);
    }

    return partition;
}
 
Example #2
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 6 votes vote down vote up
@Override
public org.apache.hadoop.hive.metastore.api.Partition getPartitionWithAuthInfo(
      String databaseName, String tableName, List<String> values,
      String userName, List<String> groupNames)
      throws MetaException, UnknownTableException, NoSuchObjectException, TException {

  // TODO move this into the service
  org.apache.hadoop.hive.metastore.api.Partition partition = getPartition(databaseName, tableName, values);
  org.apache.hadoop.hive.metastore.api.Table table = getTable(databaseName, tableName);
  if ("TRUE".equalsIgnoreCase(table.getParameters().get("PARTITION_LEVEL_PRIVILEGE"))) {
    String partName = Warehouse.makePartName(table.getPartitionKeys(), values);
    HiveObjectRef obj = new HiveObjectRef();
    obj.setObjectType(HiveObjectType.PARTITION);
    obj.setDbName(databaseName);
    obj.setObjectName(tableName);
    obj.setPartValues(values);
    org.apache.hadoop.hive.metastore.api.PrincipalPrivilegeSet privilegeSet =
          this.get_privilege_set(obj, userName, groupNames);
    partition.setPrivileges(privilegeSet);
  }

  return partition;
}
 
Example #3
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
@Override
public Index getIndex(String dbName, String tblName, String indexName) throws MetaException, UnknownTableException,
      NoSuchObjectException, TException {
  org.apache.hadoop.hive.metastore.api.Table originTable = getTable(dbName, tblName);
  Map<String, String> map = originTable.getParameters();
  String indexTableName = INDEX_PREFIX + indexName;
  if(!map.containsKey(indexTableName)) {
    throw new NoSuchObjectException("can not find index: " + indexName);
  }
  Table indexTableObject = stringToCatalogTable(map.get(indexTableName));
  return CatalogToHiveConverter.convertTableObjectToIndex(indexTableObject);
}
 
Example #4
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<FieldSchema> get_schema_with_environment_context(
    String db_name,
    String table_name,
    EnvironmentContext environment_context)
    throws MetaException, UnknownTableException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping
      .getClient()
      .get_schema_with_environment_context(mapping.transformInboundDatabaseName(db_name), table_name,
          environment_context);
}
 
Example #5
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<FieldSchema> get_fields_with_environment_context(
    String db_name,
    String table_name,
    EnvironmentContext environment_context)
    throws MetaException, UnknownTableException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping
      .getClient()
      .get_fields_with_environment_context(mapping.transformInboundDatabaseName(db_name), table_name,
          environment_context);
}
 
Example #6
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public boolean isPartitionMarkedForEvent(
    String db_name,
    String tbl_name,
    Map<String, String> part_vals,
    PartitionEventType eventType)
    throws MetaException, NoSuchObjectException, UnknownDBException, UnknownTableException, UnknownPartitionException,
    InvalidPartitionException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping
      .getClient()
      .isPartitionMarkedForEvent(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals, eventType);
}
 
Example #7
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public void markPartitionForEvent(
    String db_name,
    String tbl_name,
    Map<String, String> part_vals,
    PartitionEventType eventType)
    throws MetaException, NoSuchObjectException, UnknownDBException, UnknownTableException, UnknownPartitionException,
    InvalidPartitionException, TException {
  DatabaseMapping mapping = checkWritePermissions(db_name);
  mapping
      .getClient()
      .markPartitionForEvent(mapping.transformInboundDatabaseName(db_name), tbl_name, part_vals, eventType);
}
 
Example #8
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<FieldSchema> get_schema(String db_name, String table_name)
    throws MetaException, UnknownTableException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping.getClient().get_schema(mapping.transformInboundDatabaseName(db_name), table_name);
}
 
Example #9
Source File: FederatedHMSHandler.java    From waggle-dance with Apache License 2.0 5 votes vote down vote up
@Override
@Loggable(value = Loggable.DEBUG, skipResult = true, name = INVOCATION_LOG_NAME)
public List<FieldSchema> get_fields(String db_name, String table_name)
    throws MetaException, UnknownTableException, UnknownDBException, TException {
  DatabaseMapping mapping = databaseMappingService.databaseMapping(db_name);
  return mapping.getClient().get_fields(mapping.transformInboundDatabaseName(db_name), table_name);
}
 
Example #10
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
@Override
public void markPartitionForEvent(
    String dbName,
    String tblName,
    Map<String, String> partKVs,
    PartitionEventType eventType
) throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException,
    UnknownPartitionException, InvalidPartitionException {
  glueMetastoreClientDelegate.markPartitionForEvent(dbName, tblName, partKVs, eventType);
}
 
Example #11
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
@Override
public void markPartitionForEvent(
    String dbName,
    String tblName,
    Map<String, String> partKVs,
    PartitionEventType eventType
) throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException,
    UnknownPartitionException, InvalidPartitionException {
  glueMetastoreClientDelegate.markPartitionForEvent(dbName, tblName, partKVs, eventType);
}
 
Example #12
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 5 votes vote down vote up
@Override
public Index getIndex(String dbName, String tblName, String indexName) throws MetaException, UnknownTableException,
      NoSuchObjectException, TException {
    org.apache.hadoop.hive.metastore.api.Table originTable = getTable(dbName, tblName);
    Map<String, String> map = originTable.getParameters();
    String indexTableName = INDEX_PREFIX + indexName;
    if(!map.containsKey(indexTableName)) {
        throw new NoSuchObjectException("can not find index: " + indexName);
    }
    Table indexTableObject = stringToCatalogTable(map.get(indexTableName));
    return CatalogToHiveConverter.convertTableObjectToIndex(indexTableObject);
}
 
Example #13
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Deprecated
public void dropTable(String tableName, boolean deleteData) throws MetaException, UnknownTableException, TException,
      NoSuchObjectException {
  dropTable(DEFAULT_DATABASE_NAME, tableName, deleteData, false);
}
 
Example #14
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public List<FieldSchema> getFields(String db, String tableName) throws MetaException, TException,
      UnknownTableException, UnknownDBException {
  return glueMetastoreClientDelegate.getFields(db, tableName);
}
 
Example #15
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Deprecated
public void dropTable(String tableName, boolean deleteData) throws MetaException, UnknownTableException, TException,
      NoSuchObjectException {
    dropTable(DEFAULT_DATABASE_NAME, tableName, deleteData, false);
}
 
Example #16
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public org.apache.hadoop.hive.metastore.api.Partition getPartition(String dbName, String tblName, String partitionName)
    throws MetaException, UnknownTableException, NoSuchObjectException, TException {
  return glueMetastoreClientDelegate.getPartition(dbName, tblName, partitionName);
}
 
Example #17
Source File: MetastoreClientTableIntegrationTest.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Test (expected = UnknownTableException.class)
public void dropTableInvalidWithUnKnownTable() throws Exception {
  metastoreClient.dropTable(hiveDB.getName(), invalidTable, false, false);
}
 
Example #18
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public List<FieldSchema> getSchema(String db, String tableName) throws MetaException, TException, UnknownTableException,
      UnknownDBException {
  return glueMetastoreClientDelegate.getSchema(db, tableName);
}
 
Example #19
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isPartitionMarkedForEvent(String dbName, String tblName, Map<String, String> partKVs, PartitionEventType eventType)
    throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException,
    UnknownPartitionException, InvalidPartitionException {
  return glueMetastoreClientDelegate.isPartitionMarkedForEvent(dbName, tblName, partKVs, eventType);
}
 
Example #20
Source File: MetastoreClientTableIntegrationTest.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Test (expected = UnknownTableException.class)
public void alterTableInvalidUnknownTable() throws Exception {
  metastoreClient.alter_table(hiveDB.getName(), hiveTable.getTableName(), hiveTable);
}
 
Example #21
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isPartitionMarkedForEvent(String dbName, String tblName, Map<String, String> partKVs, PartitionEventType eventType)
    throws MetaException, NoSuchObjectException, TException, UnknownTableException, UnknownDBException,
    UnknownPartitionException, InvalidPartitionException {
  return glueMetastoreClientDelegate.isPartitionMarkedForEvent(dbName, tblName, partKVs, eventType);
}
 
Example #22
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public List<FieldSchema> getSchema(String db, String tableName) throws MetaException, TException, UnknownTableException,
      UnknownDBException {
  return glueMetastoreClientDelegate.getSchema(db, tableName);    
}
 
Example #23
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public org.apache.hadoop.hive.metastore.api.Partition getPartition(String dbName, String tblName, String partitionName)
    throws MetaException, UnknownTableException, NoSuchObjectException, TException {
  return glueMetastoreClientDelegate.getPartition(dbName, tblName, partitionName);
}
 
Example #24
Source File: AWSCatalogMetastoreClient.java    From aws-glue-data-catalog-client-for-apache-hive-metastore with Apache License 2.0 4 votes vote down vote up
@Override
public List<FieldSchema> getFields(String db, String tableName) throws MetaException, TException,
      UnknownTableException, UnknownDBException {
    return glueMetastoreClientDelegate.getFields(db, tableName);
}