Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.NoSuchObjectException


  @Override
  public Role getRole(String roleName) throws NoSuchObjectException {
    MRole mRole = this.getMRole(roleName);
    if (mRole == null) {
      throw new NoSuchObjectException(roleName + " role can not be found.");
    }
    Role ret = new Role(mRole.getRoleName(), mRole.getCreateTime(), mRole
        .getOwnerName());
    return ret;
  }
View Full Code Here


        break;
      }
    }

    if (!foundCol) {
      throw new
        NoSuchObjectException("Column " + colName +
        " for which stats gathering is requested doesn't exist.");
    }

    List<MPartitionColumnStatistics> oldStats = getMPartitionColumnStatistics(
View Full Code Here

    for (ColumnStatisticsObj statsObj:statsObjs) {
      // We have to get partition again because DataNucleus
      MPartition mPartition = getMPartition(
          statsDesc.getDbName(), statsDesc.getTableName(), partVals);
      if (partition == null) {
        throw new NoSuchObjectException("Partition for which stats is gathered doesn't exist.");
      }
      MPartitionColumnStatistics mStatsObj =
          StatObjectConverter.convertToMPartitionColumnStatistics(mPartition, statsDesc, statsObj);
      writeMPartitionColumnStatistics(table, partition, mStatsObj);
    }
View Full Code Here

      MTable mTable = getMTable(dbName, tableName);
      MPartitionColumnStatistics mStatsObj;
      List<MPartitionColumnStatistics> mStatsObjColl;

      if (mTable == null) {
        throw new
          NoSuchObjectException("Table " + tableName +
          "  for which stats deletion is requested doesn't exist");
      }

      MPartition mPartition =
          getMPartition(dbName, tableName, partVals);

      if (mPartition == null) {
        throw new
          NoSuchObjectException("Partition " + partName +
          " for which stats deletion is requested doesn't exist");
      }

      Query query = pm.newQuery(MPartitionColumnStatistics.class);
      String filter;
      String parameters;

      if (colName != null) {
        filter = "partition.partitionName == t1 && dbName == t2 && tableName == t3 && " +
                    "colName == t4";
        parameters = "java.lang.String t1, java.lang.String t2, " +
                        "java.lang.String t3, java.lang.String t4";
      } else {
        filter = "partition.partitionName == t1 && dbName == t2 && tableName == t3";
        parameters = "java.lang.String t1, java.lang.String t2, java.lang.String t3";
      }

      query.setFilter(filter);
      query
        .declareParameters(parameters);

      if (colName != null) {
        query.setUnique(true);
        mStatsObj = (MPartitionColumnStatistics)query.executeWithArray(partName.trim(),
                                                dbName.trim(), tableName.trim(), colName.trim());
        pm.retrieve(mStatsObj);

        if (mStatsObj != null) {
          pm.deletePersistent(mStatsObj);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" +dbName + " table="
              + tableName + " partition=" + partName + " col=" + colName);
        }
      } else {
        mStatsObjColl= (List<MPartitionColumnStatistics>)query.execute(partName.trim(),
                                  dbName.trim(), tableName.trim());
        pm.retrieveAll(mStatsObjColl);

        if (mStatsObjColl != null) {
          pm.deletePersistentAll(mStatsObjColl);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" + dbName +
            " table=" + tableName + " partition" + partName);
        }
      }
      ret = commitTransaction();
    } catch(NoSuchObjectException e) {
View Full Code Here

      MTable mTable = getMTable(dbName, tableName);
      MTableColumnStatistics mStatsObj;
        List<MTableColumnStatistics> mStatsObjColl;

      if (mTable == null) {
        throw new
          NoSuchObjectException("Table " + tableName +
          "  for which stats deletion is requested doesn't exist");
      }

      Query query = pm.newQuery(MTableColumnStatistics.class);
      String filter;
      String parameters;

      if (colName != null) {
        filter = "table.tableName == t1 && dbName == t2 && colName == t3";
        parameters = "java.lang.String t1, java.lang.String t2, java.lang.String t3";
      } else {
        filter = "table.tableName == t1 && dbName == t2";
        parameters = "java.lang.String t1, java.lang.String t2";
      }

      query.setFilter(filter);
      query
        .declareParameters(parameters);

      if (colName != null) {
        query.setUnique(true);
        mStatsObj = (MTableColumnStatistics)query.execute(tableName.trim(),
                                                    dbName.trim(), colName.trim());
        pm.retrieve(mStatsObj);

        if (mStatsObj != null) {
          pm.deletePersistent(mStatsObj);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" +dbName + " table="
              + tableName + " col=" + colName);
        }
      } else {
        mStatsObjColl= (List<MTableColumnStatistics>)query.execute(tableName.trim(), dbName.trim());
        pm.retrieveAll(mStatsObjColl);

        if (mStatsObjColl != null) {
          pm.deletePersistentAll(mStatsObjColl);
        } else {
          throw new NoSuchObjectException("Column stats doesn't exist for db=" + dbName +
            " table=" + tableName);
        }
      }
      ret = commitTransaction();
    } catch(NoSuchObjectException e) {
View Full Code Here

        rollbackTransaction();
      }
    }
    LOG.debug("Done executing updateMasterKey with status : " + committed);
    if (null == masterKey) {
      throw new NoSuchObjectException("No key found with keyId: " + id);
    }
    if (!committed) {
      throw new MetaException("Though key is found, failed to update it. " + id);
    }
  }
View Full Code Here

      if (!committed) {
        rollbackTransaction();
      }
    }
    if (mVerTables.isEmpty()) {
      throw new NoSuchObjectException("No matching version found");
    }
    if (mVerTables.size() > 1) {
      throw new MetaException("Metastore contains multiple versions");
    }
    return mVerTables.get(0);
View Full Code Here

      Type ret = null;
      Exception ex = null;
      try {
        ret = getMS().getType(name);
        if (null == ret) {
          throw new NoSuchObjectException("Type \"" + name + "\" not found.");
        }
      } catch (Exception e) {
        ex = e;
        if (e instanceof MetaException) {
          throw (MetaException) e;
View Full Code Here

      boolean success = false;
      try {
        ms.openTransaction();
        // drop any partitions
        if (!is_type_exists(ms, typeName)) {
          throw new NoSuchObjectException(typeName + " doesn't exist");
        }
        if (!ms.dropType(typeName)) {
          throw new MetaException("Unable to drop type " + typeName);
        }
        success = ms.commitTransaction();
View Full Code Here

        ms.openTransaction();

        Database db = ms.getDatabase(tbl.getDbName());
        if (db == null) {
          throw new NoSuchObjectException("The database " + tbl.getDbName() + " does not exist");
        }

        // get_table checks whether database exists, it should be moved here
        if (is_table_exists(ms, tbl.getDbName(), tbl.getTableName())) {
          throw new AlreadyExistsException("Table " + tbl.getTableName()
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.NoSuchObjectException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.