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


Java InvalidObjectException类代码示例

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


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

示例1: dropPartitionsCoreNoTxn

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
private List<Partition> dropPartitionsCoreNoTxn(
        final RawStore ms, final Table tbl, final List<List<String>> partsValues)
        throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException {
    final List<Partition> deletedPartitions = new ArrayList<Partition>();
    Partition part = null;
    final String dbName = tbl.getDbName();
    final String tblName = tbl.getTableName();

    for (List<String> partValues : partsValues) {
        part = ms.getPartition(dbName, tblName, partValues);
        if (part == null) {
            throw new NoSuchObjectException("Partition doesn't exist. "
                    + partValues);
        }
        if (!ms.dropPartition(dbName, tblName, partValues)) {
            throw new MetaException("Unable to drop partition");
        }
        deletedPartitions.add(part);
    }
    return deletedPartitions;
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:22,代码来源:MetacatHMSHandler.java

示例2: getPartitionsWithAuth

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Override
public List<Partition> getPartitionsWithAuth(String dbName, String tblName,
    short maxParts, String userName, List<String> groupNames)
    throws MetaException, InvalidObjectException {
  if (filterTables(dbName, Lists.newArrayList(tblName)).isEmpty()) {
    throw new MetaException(getNoAccessMessageForTable(dbName, tblName));
  }
  return super.getPartitionsWithAuth(dbName, tblName, maxParts, userName,
      groupNames);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:11,代码来源:AuthorizingObjectStoreV2.java

示例3: create_table

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void create_table()
  throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {
  Table table = new Table();
  table.setDbName(DB_P);
  Table inboundTable = new Table();
  inboundTable.setDbName("inbound");
  when(primaryMapping.transformInboundTable(table)).thenReturn(inboundTable);
  handler.create_table(table);
  verify(primaryMapping).checkWritePermissions(DB_P);
  verify(primaryClient).create_table(inboundTable);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:13,代码来源:FederatedHMSHandlerTest.java

示例4: create_table_with_environment_context

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void create_table_with_environment_context()
  throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {
  EnvironmentContext environmentContext = new EnvironmentContext();
  Table table = new Table();
  table.setDbName(DB_P);
  Table inboundTable = new Table();
  inboundTable.setDbName("inbound");
  when(primaryMapping.transformInboundTable(table)).thenReturn(inboundTable);
  handler.create_table_with_environment_context(table, environmentContext);
  verify(primaryMapping).checkWritePermissions(DB_P);
  verify(primaryClient).create_table_with_environment_context(inboundTable, environmentContext);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:14,代码来源:FederatedHMSHandlerTest.java

示例5: add_partition

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void add_partition() throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  Partition newPartition = new Partition();
  newPartition.setDbName(DB_P);
  Partition inbound = new Partition();
  Partition outbound = new Partition();
  when(primaryMapping.transformInboundPartition(newPartition)).thenReturn(inbound);
  when(primaryClient.add_partition(inbound)).thenReturn(inbound);
  when(primaryMapping.transformOutboundPartition(inbound)).thenReturn(outbound);
  Partition result = handler.add_partition(newPartition);
  assertThat(result, is(outbound));
  verify(primaryMapping).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:14,代码来源:FederatedHMSHandlerTest.java

示例6: add_partition_with_environment_context

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void add_partition_with_environment_context()
  throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  EnvironmentContext environmentContext = new EnvironmentContext();
  Partition newPartition = new Partition();
  newPartition.setDbName(DB_P);
  Partition inbound = new Partition();
  Partition outbound = new Partition();
  when(primaryMapping.transformInboundPartition(newPartition)).thenReturn(inbound);
  when(primaryClient.add_partition_with_environment_context(inbound, environmentContext)).thenReturn(inbound);
  when(primaryMapping.transformOutboundPartition(inbound)).thenReturn(outbound);
  Partition result = handler.add_partition_with_environment_context(newPartition, environmentContext);
  assertThat(result, is(outbound));
  verify(primaryMapping).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:16,代码来源:FederatedHMSHandlerTest.java

示例7: add_partitions

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void add_partitions() throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  Partition newPartition1 = new Partition();
  newPartition1.setDbName(DB_P);
  Partition newPartition2 = new Partition();
  newPartition2.setDbName(DB_P);
  List<Partition> inbound = Lists.newArrayList(new Partition());
  List<Partition> partitions = Lists.newArrayList(newPartition1, newPartition2);
  when(primaryMapping.transformInboundPartitions(partitions)).thenReturn(inbound);
  when(primaryClient.add_partitions(inbound)).thenReturn(2);
  int result = handler.add_partitions(partitions);
  assertThat(result, is(2));
  verify(primaryMapping, times(2)).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:15,代码来源:FederatedHMSHandlerTest.java

示例8: add_partitions_pspec

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void add_partitions_pspec() throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  PartitionSpec newPartitionPSpec1 = new PartitionSpec();
  newPartitionPSpec1.setDbName(DB_P);
  PartitionSpec newPartitionPspec2 = new PartitionSpec();
  newPartitionPspec2.setDbName(DB_P);
  List<PartitionSpec> inbound = Lists.newArrayList(new PartitionSpec());
  List<PartitionSpec> partitionsPspec = Lists.newArrayList(newPartitionPSpec1, newPartitionPspec2);
  when(primaryMapping.transformInboundPartitionSpecs(partitionsPspec)).thenReturn(inbound);
  when(primaryClient.add_partitions_pspec(inbound)).thenReturn(2);
  int result = handler.add_partitions_pspec(partitionsPspec);
  assertThat(result, is(2));
  verify(primaryMapping, times(2)).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:15,代码来源:FederatedHMSHandlerTest.java

示例9: append_partition

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void append_partition() throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  Partition inbound = new Partition();
  Partition outbound = new Partition();
  List<String> partVals = Lists.newArrayList();
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  when(primaryClient.append_partition("inbound", "table1", partVals)).thenReturn(inbound);
  when(primaryMapping.transformOutboundPartition(inbound)).thenReturn(outbound);
  Partition result = handler.append_partition(DB_P, "table1", partVals);
  assertThat(result, is(outbound));
  verify(primaryMapping).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:13,代码来源:FederatedHMSHandlerTest.java

示例10: add_partitions_req

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void add_partitions_req() throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  Partition newPartition1 = new Partition();
  newPartition1.setDbName(DB_P);
  Partition newPartition2 = new Partition();
  newPartition2.setDbName(DB_P);
  List<Partition> partitions = Lists.newArrayList(newPartition1, newPartition2);
  AddPartitionsRequest request = new AddPartitionsRequest();
  request.setDbName(DB_P);
  request.setParts(partitions);
  AddPartitionsRequest inbound = new AddPartitionsRequest();
  AddPartitionsResult addPartitionResult = new AddPartitionsResult();
  AddPartitionsResult outbound = new AddPartitionsResult();
  when(primaryMapping.transformInboundAddPartitionsRequest(request)).thenReturn(inbound);
  when(primaryClient.add_partitions_req(inbound)).thenReturn(addPartitionResult);
  when(primaryMapping.transformOutboundAddPartitionsResult(addPartitionResult)).thenReturn(outbound);

  AddPartitionsResult result = handler.add_partitions_req(request);
  assertThat(result, is(outbound));
  verify(primaryMapping, times(3)).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:22,代码来源:FederatedHMSHandlerTest.java

示例11: append_partition_with_environment_context

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void append_partition_with_environment_context()
  throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  EnvironmentContext environmentContext = new EnvironmentContext();
  Partition inbound = new Partition();
  Partition outbound = new Partition();
  List<String> partVals = Lists.newArrayList();
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  when(primaryClient.append_partition_with_environment_context("inbound", "table1", partVals, environmentContext))
      .thenReturn(inbound);
  when(primaryMapping.transformOutboundPartition(inbound)).thenReturn(outbound);
  Partition result = handler.append_partition_with_environment_context(DB_P, "table1", partVals, environmentContext);
  assertThat(result, is(outbound));
  verify(primaryMapping).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:16,代码来源:FederatedHMSHandlerTest.java

示例12: append_partition_by_name

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void append_partition_by_name()
  throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  Partition inbound = new Partition();
  Partition outbound = new Partition();
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  when(primaryClient.append_partition_by_name("inbound", "table1", "partName")).thenReturn(inbound);
  when(primaryMapping.transformOutboundPartition(inbound)).thenReturn(outbound);
  Partition result = handler.append_partition_by_name(DB_P, "table1", "partName");
  assertThat(result, is(outbound));
  verify(primaryMapping).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:13,代码来源:FederatedHMSHandlerTest.java

示例13: append_partition_by_name_with_environment_context

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void append_partition_by_name_with_environment_context()
  throws InvalidObjectException, AlreadyExistsException, MetaException, TException {
  EnvironmentContext environmentContext = new EnvironmentContext();
  Partition inbound = new Partition();
  Partition outbound = new Partition();
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  when(primaryClient.append_partition_by_name_with_environment_context("inbound", "table1", "partName",
      environmentContext)).thenReturn(inbound);
  when(primaryMapping.transformOutboundPartition(inbound)).thenReturn(outbound);
  Partition result = handler.append_partition_by_name_with_environment_context(DB_P, "table1", "partName",
      environmentContext);
  assertThat(result, is(outbound));
  verify(primaryMapping).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:16,代码来源:FederatedHMSHandlerTest.java

示例14: exchange_partition

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
@Test
public void exchange_partition()
  throws MetaException, NoSuchObjectException, InvalidObjectException, InvalidInputException, TException {
  Partition partition = new Partition();
  Partition outbound = new Partition();
  Map<String, String> specs = new HashMap<>();
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  when(primaryClient.exchange_partition(specs, "inbound", "soureTable", "inbound", "destTable"))
      .thenReturn(partition);
  when(primaryMapping.transformOutboundPartition(partition)).thenReturn(outbound);
  Partition result = handler.exchange_partition(specs, DB_P, "soureTable", DB_P, "destTable");
  assertThat(result, is(outbound));
  verify(primaryMapping, times(2)).checkWritePermissions(DB_P);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:15,代码来源:FederatedHMSHandlerTest.java

示例15: add_drop_partitions

import org.apache.hadoop.hive.metastore.api.InvalidObjectException; //导入依赖的package包/类
/**
 * Adds and drops partitions in one transaction.
 *
 * @param databaseName database name
 * @param tableName    table name
 * @param addParts     list of partitions
 * @param dropParts    list of partition values
 * @param deleteData   if true, deletes the data
 * @return true if successful
 * @throws NoSuchObjectException Exception if table does not exists
 * @throws MetaException         Exception if
 * @throws TException            any internal exception
 */
@SuppressWarnings({"checkstyle:methodname"})
public boolean add_drop_partitions(final String databaseName,
                                   final String tableName, final List<Partition> addParts,
                                   final List<List<String>> dropParts, final boolean deleteData)
        throws NoSuchObjectException, MetaException, TException {
    startFunction("add_drop_partitions : db=" + databaseName + " tbl=" + tableName);
    if (addParts.size() == 0 && dropParts.size() == 0) {
        return true;
    }
    for (List<String> partVals : dropParts) {
        LOG.info("Drop Partition values:" + partVals);
    }
    for (Partition part : addParts) {
        LOG.info("Add Partition values:" + part);
    }

    boolean ret = false;
    Exception ex = null;
    try {
        ret = addDropPartitionsCore(getMS(), databaseName, tableName, addParts, dropParts, false, null);
    } catch (Exception e) {
        ex = e;
        if (e instanceof MetaException) {
            throw (MetaException) e;
        } else if (e instanceof InvalidObjectException) {
            throw (InvalidObjectException) e;
        } else if (e instanceof AlreadyExistsException) {
            throw (AlreadyExistsException) e;
        } else if (e instanceof NoSuchObjectException) {
            throw (NoSuchObjectException) e;
        } else {
            throw newMetaException(e);
        }
    } finally {
        endFunction("drop_partitions", ret, ex, tableName);
    }
    return ret;

}
 
开发者ID:Netflix,项目名称:metacat,代码行数:53,代码来源:MetacatHMSHandler.java


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