• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java InvalidOperationException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: authorizeCreateTable

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
private void authorizeCreateTable(PreCreateTableEvent context)
    throws InvalidOperationException, MetaException {
  HierarcyBuilder inputBuilder = new HierarcyBuilder();
  inputBuilder.addDbToOutput(getAuthServer(), context.getTable().getDbName());
  HierarcyBuilder outputBuilder = new HierarcyBuilder();
  outputBuilder.addDbToOutput(getAuthServer(), context.getTable().getDbName());

  if (!StringUtils.isEmpty(context.getTable().getSd().getLocation())) {
    String uriPath;
    try {
      uriPath = PathUtils.parseDFSURI(warehouseDir,
          getSdLocation(context.getTable().getSd()));
    } catch(URISyntaxException e) {
      throw new MetaException(e.getMessage());
    }
    inputBuilder.addUriToOutput(getAuthServer(), uriPath, warehouseDir);
  }
  authorizeMetastoreAccess(HiveOperation.CREATETABLE, inputBuilder.build(),
      outputBuilder.build());
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:21,代码来源:MetastoreAuthzBinding.java


示例2: throwExceptionIfIncompatibleColTypeChange

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
static void throwExceptionIfIncompatibleColTypeChange(
    List<FieldSchema> oldCols, List<FieldSchema> newCols)
    throws InvalidOperationException {

  List<String> incompatibleCols = new ArrayList<String>();
  int maxCols = Math.min(oldCols.size(), newCols.size());
  for (int i = 0; i < maxCols; i++) {
    if (!areColTypesCompatible(oldCols.get(i).getType(), newCols.get(i).getType())) {
      incompatibleCols.add(newCols.get(i).getName());
    }
  }
  if (!incompatibleCols.isEmpty()) {
    throw new InvalidOperationException(
        "The following columns have types incompatible with the existing " +
        "columns in their respective positions :\n" +
        Joiner.on(',').join(incompatibleCols)
      );
  }
}
 
开发者ID:facebookarchive,项目名称:swift-hive-metastore,代码行数:20,代码来源:MetaStoreUtils.java


示例3: throwExceptionIfColAddedDeletedInMiddle

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
static void throwExceptionIfColAddedDeletedInMiddle(
    List<FieldSchema> oldCols, List<FieldSchema> newCols)
    throws InvalidOperationException {

  if (oldCols.size() == newCols.size()) {
    // Nothing to do since there were no columns added or removed.
    return;
  }

  int maxCols = Math.min(oldCols.size(), newCols.size());
  for (int i = 0; i < maxCols; i++) {
    String oldColName = oldCols.get(i).getName();
    String newColName = newCols.get(i).getName();
    if (!oldColName.equals(newColName)) {
      throw new InvalidOperationException(
          "You can only add/remove columns from the end of a table." +
          "If that is indeed what you are doing here, you are seeing this " +
          "error because you are renaming a column at the same time. " +
          "Please do the rename in a separate DDL operation." +
          "Problematic columns: " +
          "Old Table: " + oldColName + ", " +
          "New Table: " + newColName
        );
    }
  }
}
 
开发者ID:facebookarchive,项目名称:swift-hive-metastore,代码行数:27,代码来源:MetaStoreUtils.java


示例4: drop_database

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
@Test
public void drop_database() throws NoSuchObjectException, InvalidOperationException, MetaException, TException {
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  handler.drop_database(DB_P, false, false);
  verify(primaryMapping).checkWritePermissions(DB_P);
  verify(primaryClient).drop_database("inbound", false, false);
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:8,代码来源:FederatedHMSHandlerTest.java


示例5: get_table_objects_by_name

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
@Test
public void get_table_objects_by_name()
  throws MetaException, InvalidOperationException, UnknownDBException, TException {
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  Table table = new Table();
  Table outbound = new Table();
  when(primaryClient.get_table_objects_by_name("inbound", Lists.newArrayList("table")))
      .thenReturn(Lists.newArrayList(table));
  when(primaryMapping.transformOutboundTable(table)).thenReturn(outbound);
  List<Table> result = handler.get_table_objects_by_name(DB_P, Lists.newArrayList("table"));
  List<Table> expected = Lists.newArrayList(outbound);
  assertThat(result, is(expected));
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:14,代码来源:FederatedHMSHandlerTest.java


示例6: get_table_names_by_filter

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
@Test
public void get_table_names_by_filter()
  throws MetaException, InvalidOperationException, UnknownDBException, TException {
  when(primaryMapping.transformInboundDatabaseName(DB_P)).thenReturn("inbound");
  List<String> tables = Lists.newArrayList("table1");
  when(primaryClient.get_table_names_by_filter("inbound", "*", (short) 2)).thenReturn(tables);
  List<String> result = handler.get_table_names_by_filter(DB_P, "*", (short) 2);
  assertThat(result, is(tables));
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:10,代码来源:FederatedHMSHandlerTest.java


示例7: alter_table

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


示例8: alter_table_with_environment_context

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


示例9: get_table_objects_by_name_req

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
@Test
public void get_table_objects_by_name_req()
  throws MetaException, InvalidOperationException, UnknownDBException, TException {
  Table table0 = new Table();
  table0.setDbName(DB_P);
  table0.setTableName("table0");
  Table table1 = new Table();
  table1.setDbName(DB_P);
  table1.setTableName("table1");
  GetTablesRequest request = new GetTablesRequest(DB_P);
  request.setTblNames(Arrays.asList(table0.getTableName(), table1.getTableName()));
  GetTablesResult response = new GetTablesResult(Arrays.asList(table0, table1));
  when(primaryClient.get_table_objects_by_name_req(request)).thenReturn(response);
  when(primaryMapping.transformInboundGetTablesRequest(request)).thenReturn(request);
  when(primaryMapping.transformOutboundGetTablesResult(response)).thenReturn(response);
  GetTablesResult result = handler.get_table_objects_by_name_req(request);
  assertThat(result.getTables().size(), is(2));
  assertThat(result.getTables().get(0).getDbName(), is(DB_P));
  assertThat(result.getTables().get(0).getTableName(), is("table0"));
  assertThat(result.getTables().get(1).getDbName(), is(DB_P));
  assertThat(result.getTables().get(1).getTableName(), is("table1"));
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:23,代码来源:FederatedHMSHandlerTest.java


示例10: updatePartitions

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
public void updatePartitions(String factOrDimtableName, String storageName,
  Map<UpdatePeriod, List<Partition>> partitions) throws HiveException, InvalidOperationException, LensException {
  for (Map.Entry entry : partitions.entrySet()) {
    List<Partition> partitionsToAlter = Lists.newArrayList();
    partitionsToAlter.addAll((List<Partition>) entry.getValue());
    String storageTableName = getStorageTableName(factOrDimtableName, storageName, (UpdatePeriod) entry.getKey());
    partitionsToAlter.addAll(
      getAllLatestPartsEquivalentTo(factOrDimtableName, storageTableName, (List<Partition>) entry.getValue()));
    getStorage(storageName).updatePartitions(storageTableName, getClient(), factOrDimtableName, partitionsToAlter);
  }
}
 
开发者ID:apache,项目名称:lens,代码行数:12,代码来源:CubeMetastoreClient.java


示例11: alterHiveTable

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
public void alterHiveTable(String table, Table hiveTable) throws HiveException, LensException {
  try {
    getClient().alterTable(table, hiveTable, null);
  } catch (InvalidOperationException e) {
    throw new HiveException(e);
  }
  if (enableCaching) {
    // refresh the table in cache
    refreshTable(table);
  }
}
 
开发者ID:apache,项目名称:lens,代码行数:12,代码来源:CubeMetastoreClient.java


示例12: updatePartitions

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
/**
 * Update existing partitions
 * @param client          hive client instance
 * @param fact            fact name
 * @param partitions      partitions to be updated
 * @throws InvalidOperationException
 * @throws HiveException
 */
public void updatePartitions(String storageTable, Hive client, String fact, List<Partition> partitions)
  throws InvalidOperationException, HiveException {
  boolean success = false;
  try {
    client.alterPartitions(storageTable, partitions, null);
    success = true;
  } finally {
    if (success) {
      commitUpdatePartition(partitions);
    } else {
      rollbackUpdatePartition(partitions);
    }
  }
}
 
开发者ID:apache,项目名称:lens,代码行数:23,代码来源:Storage.java


示例13: listTableNamesByFilter

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
@Override
public List<String> listTableNamesByFilter(String dbName, String filter,
    short maxTables) throws InvalidOperationException, UnknownDBException,
    TException {
  return filterTables(dbName,
      super.listTableNamesByFilter(dbName, filter, maxTables));
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:8,代码来源:SentryHiveMetaStoreClient.java


示例14: onEvent

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
/**
 * Main listener callback which is the entry point for Sentry
 */
@Override
public void onEvent(PreEventContext context) throws MetaException,
    NoSuchObjectException, InvalidOperationException {

  if (!needsAuthorization(getUserName())) {
    return;
  }
  switch (context.getEventType()) {
  case CREATE_TABLE:
    authorizeCreateTable((PreCreateTableEvent) context);
    break;
  case DROP_TABLE:
    authorizeDropTable((PreDropTableEvent) context);
    break;
  case ALTER_TABLE:
    authorizeAlterTable((PreAlterTableEvent) context);
    break;
  case ADD_PARTITION:
    authorizeAddPartition((PreAddPartitionEvent) context);
    break;
  case DROP_PARTITION:
    authorizeDropPartition((PreDropPartitionEvent) context);
    break;
  case ALTER_PARTITION:
    authorizeAlterPartition((PreAlterPartitionEvent) context);
    break;
  case CREATE_DATABASE:
    authorizeCreateDatabase();
    break;
  case DROP_DATABASE:
    authorizeDropDatabase((PreDropDatabaseEvent) context);
    break;
  case LOAD_PARTITION_DONE:
    // noop for now
    break;
  default:
    break;
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:43,代码来源:MetastoreAuthzBinding.java


示例15: authorizeDropDatabase

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
private void authorizeDropDatabase(PreDropDatabaseEvent context)
      throws InvalidOperationException, MetaException {
    authorizeMetastoreAccess(HiveOperation.DROPDATABASE,
 new HierarcyBuilder()
.addDbToOutput(getAuthServer(),
            context.getDatabase().getName()).build(),
        new HierarcyBuilder().addDbToOutput(getAuthServer(),
            context.getDatabase().getName()).build());
  }
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:10,代码来源:MetastoreAuthzBinding.java


示例16: authorizeDropTable

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
private void authorizeDropTable(PreDropTableEvent context)
    throws InvalidOperationException, MetaException {
  authorizeMetastoreAccess(
      HiveOperation.DROPTABLE,
      new HierarcyBuilder().addTableToOutput(getAuthServer(),
          context.getTable().getDbName(), context.getTable().getTableName())
          .build(),
      new HierarcyBuilder().addTableToOutput(getAuthServer(),
          context.getTable().getDbName(), context.getTable().getTableName())
          .build());
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:12,代码来源:MetastoreAuthzBinding.java


示例17: authorizeAlterTable

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
private void authorizeAlterTable(PreAlterTableEvent context)
    throws InvalidOperationException, MetaException {
  /*
   * There are multiple alter table options and it's tricky to figure which is
   * attempted here. Currently all alter table needs full level privilege
   * except the for setting location which also needs a privile on URI. Hence
   * we set initially set the operation to ALTERTABLE_ADDCOLS. If the client
   * has specified the location, then change to ALTERTABLE_LOCATION
   */
  HiveOperation operation = HiveOperation.ALTERTABLE_ADDCOLS;
  HierarcyBuilder inputBuilder = new HierarcyBuilder();
  inputBuilder.addTableToOutput(getAuthServer(), context.getOldTable()
      .getDbName(), context.getOldTable().getTableName());
  HierarcyBuilder outputBuilder = new HierarcyBuilder();
  outputBuilder.addTableToOutput(getAuthServer(), context.getOldTable()
      .getDbName(), context.getOldTable().getTableName());

  // if the operation requires location change, then add URI privilege check
  String oldLocationUri;
  String newLocationUri;
  try {
    oldLocationUri = PathUtils.parseDFSURI(warehouseDir,
        getSdLocation(context.getOldTable().getSd()));
    newLocationUri = PathUtils.parseDFSURI(warehouseDir,
        getSdLocation(context.getNewTable().getSd()));
  } catch (URISyntaxException e) {
    throw new MetaException(e.getMessage());
  }
  if (oldLocationUri.compareTo(newLocationUri) != 0) {
    outputBuilder.addUriToOutput(getAuthServer(), newLocationUri,
        warehouseDir);
    operation = HiveOperation.ALTERTABLE_LOCATION;
  }
  authorizeMetastoreAccess(
      operation,
      inputBuilder.build(), outputBuilder.build());

}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:39,代码来源:MetastoreAuthzBinding.java


示例18: authorizeAddPartition

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
private void authorizeAddPartition(PreAddPartitionEvent context)
    throws InvalidOperationException, MetaException, NoSuchObjectException {
  for (Partition mapiPart : context.getPartitions()) {
   HierarcyBuilder inputBuilder = new HierarcyBuilder();
    inputBuilder.addTableToOutput(getAuthServer(), mapiPart
        .getDbName(), mapiPart.getTableName());
    HierarcyBuilder outputBuilder = new HierarcyBuilder();
   outputBuilder.addTableToOutput(getAuthServer(), mapiPart
       .getDbName(), mapiPart.getTableName());
   // check if we need to validate URI permissions when storage location is
   // non-default, ie something not under the parent table

    String partitionLocation = null;
    if (mapiPart.isSetSd()) {
      partitionLocation = mapiPart.getSd().getLocation();
   }
   if (!StringUtils.isEmpty(partitionLocation)) {
     String tableLocation = context
         .getHandler()
         .get_table(mapiPart.getDbName(),
             mapiPart.getTableName()).getSd().getLocation();
     String uriPath;
     try {
       uriPath = PathUtils.parseDFSURI(warehouseDir, mapiPart
           .getSd().getLocation());
     } catch (URISyntaxException e) {
       throw new MetaException(e.getMessage());
     }
      if (!partitionLocation.equals(tableLocation) &&
          !partitionLocation.startsWith(tableLocation + File.separator)) {
        outputBuilder.addUriToOutput(getAuthServer(), uriPath, warehouseDir);
     }
   }
    authorizeMetastoreAccess(HiveOperation.ALTERTABLE_ADDPARTS,
       inputBuilder.build(), outputBuilder.build());
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:38,代码来源:MetastoreAuthzBinding.java


示例19: authorizeDropPartition

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
protected void authorizeDropPartition(PreDropPartitionEvent context)
    throws InvalidOperationException, MetaException {
  authorizeMetastoreAccess(
      HiveOperation.ALTERTABLE_DROPPARTS,
      new HierarcyBuilder().addTableToOutput(getAuthServer(),
          context.getPartition().getDbName(),
          context.getPartition().getTableName()).build(),
      new HierarcyBuilder().addTableToOutput(getAuthServer(),
          context.getPartition().getDbName(),
          context.getPartition().getTableName()).build());
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:12,代码来源:MetastoreAuthzBinding.java


示例20: authorizeAlterPartition

import org.apache.hadoop.hive.metastore.api.InvalidOperationException; //导入依赖的package包/类
private void authorizeAlterPartition(PreAlterPartitionEvent context)
    throws InvalidOperationException, MetaException, NoSuchObjectException {
  /*
   * There are multiple alter partition options and it's tricky to figure out
   * which is attempted here. Currently all alter partition need full level
   * privilege except the for setting location which also needs a privilege on
   * URI. Currently we don't try to distinguish the operation type. All alter
   * partitions are treated as set-location
   */
  HierarcyBuilder inputBuilder = new HierarcyBuilder().addTableToOutput(
      getAuthServer(), context.getDbName(), context.getTableName());
  HierarcyBuilder outputBuilder = new HierarcyBuilder().addTableToOutput(
      getAuthServer(), context.getDbName(), context.getTableName());

  Partition partition = context.getNewPartition();
  String partitionLocation = getSdLocation(partition.getSd());
  if (!StringUtils.isEmpty(partitionLocation)) {
    String tableLocation = context.getHandler().get_table(
        partition.getDbName(), partition.getTableName()).getSd().getLocation();

    String uriPath;
    try {
      uriPath = PathUtils.parseDFSURI(warehouseDir, partitionLocation);
      } catch (URISyntaxException e) {
      throw new MetaException(e.getMessage());
    }
    if (!partitionLocation.startsWith(tableLocation + File.separator)) {
      outputBuilder.addUriToOutput(getAuthServer(), uriPath, warehouseDir);
    }
  }
  authorizeMetastoreAccess(
      HiveOperation.ALTERPARTITION_LOCATION,
      inputBuilder.build(), outputBuilder.build());
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:35,代码来源:MetastoreAuthzBinding.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProxyUriUtils类代码示例发布时间:2022-05-22
下一篇:
Java Player类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap